nushell / tree-sitter-nu

A tree-sitter grammar for nu-lang, the language of nushell
MIT License
122 stars 27 forks source link

Parsing of pipeline fails when the first pipeline element is variable or control expression, and there is a newline before the next element #52

Closed kit494way closed 11 months ago

kit494way commented 11 months ago

Example 1. スクリーンショット 2024-01-02 145803

Example 2. スクリーンショット 2024-01-02 151850

In Example 1, match expression must be parsed as a pipe_element but it is not. And entire script must be parsed as a pipeline but it is not.

In Example 2, $xs and | each {|x| $x } must be parsed as pipe_element of same pipeline but they are not.

fdncred commented 11 months ago

Agreed. When I edit nushell's toolkit.nu in helix and notice this frequently. I also notice this if/else section that is parsed and colored wrong, although unrelated to this. Just thought I'd mention it. image

kit494way commented 11 months ago

I created another issue for the case if/else section is parsed incorrectly.