Closed CabalCrow closed 6 months ago
I'm guessing that this has something to do with https://github.com/nushell/tree-sitter-nu/blob/main/queries/nu/highlights.scm. I think it's been a while since the highlights.scm file was updated. I was looking at it last week and noticed that some of the grammar isn't in the file at all. It deserves a good run through if someone has the time.
Well.... maybe the grammar isn't expecting and else without braces. That could probably be changed in the grammar.
I think it is straight up a problem with the grammar rather than highlighting. TSPlayground is identifying the let keyword with identifier instead:
Here how it should look:
@kit494way any thoughts on this? Do you have time to help update the grammar?
In the grammar.js on lines 348 & 366 you have this rule for the else statement:
field("else_block", $.block),
however the else block can actually take a lot more (compared to if which can indeed only take a block). Adding expressions & commands seems to work for the most part:
field("else_block", choice($.block, $._expression, $.cmd_identifier)),
Any idea on any other potential elements that could be put after an else?
Treesitter highlighting fails when else flag is missing a closure
else $statement
.Look at the let keywords below. Example without closure: Example with closure:
Tested in neovim.