eclipse-tm4e / tm4e

TextMate support in Eclipse IDE
https://projects.eclipse.org/projects/technology.tm4e
Eclipse Public License 2.0
94 stars 57 forks source link

Code Folding #50

Open angelozerr opened 7 years ago

angelozerr commented 7 years ago

TextMate grammar can define folding https://manual.macromates.com/en/navigation_overview

It should be cool if tm4e could provide the org.eclipse.tm4e.ui.folding.TMFoldingStrategy which supports this feature.

mickaelistria commented 7 years ago

Do you have an estimation of the ratio of textmate grammars that do enable folding? does VSCode rely on it ?

angelozerr commented 7 years ago

Do you have an estimation of the ratio of textmate grammars that do enable folding? does VSCode rely on it ?

To be honnest with you, I don't remember. I must study again that but I'm very busy for the moment with JDT Codelens (an another project/topic).

angelozerr commented 7 years ago

@micktaelistria the only thing that I can tell you is that VSCode uses by default the indent folding strategy that I have implemented for Eclipse https://github.com/angelozerr/typescript.java/blob/master/eclipse/ts.eclipse.ide.ui/src/ts/eclipse/ide/ui/folding/IndentFoldingStrategy.java

Inside VSCode TypeScript, JSON, etc editor uses this folding strategy. I know you are working on folding feature for Generic Editor. IMHO, I think Generic Editor should use this indent folding strategy by default.

mickaelistria commented 7 years ago

I think Generic Editor should use this indent folding strategy by default.

I agree. Now that Generic Editor has an extension point for reconciler and an example about folding, it shouldn't be that hard to add it. Can you please open an enhancement request for that?

angelozerr commented 7 years ago

Can you please open an enhancement request for that?

This bug exists https://bugs.eclipse.org/bugs/show_bug.cgi?id=512956

mickaelistria commented 7 years ago

This bug exists https://bugs.eclipse.org/bugs/show_bug.cgi?id=512956

That bug is about providing the extension-point, not about providing some (default) implementation.

angelozerr commented 7 years ago

That bug is about providing the extension-point, not about providing some (default) implementation.

Done https://bugs.eclipse.org/bugs/show_bug.cgi?id=520659

bartoszbinda commented 5 years ago

Was it implemented in tm4e? How can I use it in generic editor to fold/unfold yaml or json?

angelozerr commented 5 years ago

Today tm4e doesn't support code folding, but I tell me if it's a good idea since LSP4E supports now folding. For instance json language server supports folding. For yaml, I don't know.

norru commented 5 years ago

What's the status of this?

mickaelistria commented 5 years ago

Still open, looking for volunteers to fix it. But as @angelozerr mentions, LSP4E now supports folding, so there is less value in using TM4E for that.

sebthom commented 2 years ago

It looks like some kind of folding now happens even without LSP, but it seems to be broken.

For toml only two sections are marked as foldable: image

For a cpp file the wrong lines are folded: screen