[TxMt] Re: Broken code folding (javascript)

Kyle Kirbatski kyle.kirby at me.com
Mon Oct 14 12:22:11 UTC 2019


Good to know. Thank you.

Sent from my iPhone

> On Oct 14, 2019, at 2:54 AM, Allan Odgaard <mailinglist at textmate.org> wrote:
> 
> 
> On 7 Oct 2019, at 16:31, Kyle Kirbatski wrote:
> 
> And try to code fold on the line "if ( !Array.isArraty(environment)) {“ then it ends up folding the entire function declaration.
> 
> How can I make this work as expected? I have a sneaky suspicion that this is a fatal flaw with TextMate.
> 
> It’s a limitation of how foldings are defined, as foldable lines are determined by a regular expression match.
> 
> So a line either starts a fold or stops a fold, it can’t do both, as the regular expression match is run against the full line, so TextMate wouldn’t know at what column the respective patterns think the folding should start/stop.
> 
> The Language Server Protocol has a command/extension to request folding ranges from a language server, so if TextMate gets support for LSP, it could make use of this to get better ranges, assuming the language server for the respective language supports it, as TextMate itself has no problem folding your code as desired (you can fold manually by selecting the contents of the braces and press F1).
> 
> 
> _______________________________________________
> TextMate mailing list
> TextMate at lists.macromates.com
> https://lists.macromates.com/listinfo/textmate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macromates.com/textmate/attachments/20191014/8f042026/attachment.html>


More information about the TextMate mailing list