eclipse-xtext / eclipse-xtext/xtext
Add a FoldingRegionProvider that folds on each { and } pairs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
The DefaultFoldingRegionProvider creates folding regions based on the AST structure.
It should be useful to create a new FoldingRegionProvider that creates folding regions considering the opening and closing curly braces.
Steps to reproduce:
- Create a new Xtext project with the following grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
greetings+=Greeting*;
Greeting:
'Hello' '{'
'from' sender=ID 'to'
'{' receivers += ID+ '}'
'}';
- Start runtime Eclipse and create a
test.mydslfile with the following content:
Hello {
from Tamas to {
Eclipse
Xtext
}
}
- Xtext calculates only one folding region on default (left side). Using the improved
FoldingRegionProvider, two folding regions should be calculated (right side)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/folding/DefaultFoldingRegionProvider.java and compare its AST-based folding behavior with the brace pairs in the issue's MyDsl grammar. Reproduce the example in a runtime Eclipse instance, then verify that the nested grammar produces two folding regions on the right side.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100