mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 08:50:11 -04:00
fix(nickel): wrong indent on line after top level comment (#4792)
* fix(nickel): wrong indent on line after top level comment
Previous incorrect indentation on line after top level comment:
```
# no indent after this comment
{
another = 1
}
```
Expected result:
```
# no indent after this comment
{
another = 1
}
````
This commit is contained in:
parent
ec0d0ffe51
commit
dba8c8e781
3 changed files with 11 additions and 5 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
[
|
[
|
||||||
(term)
|
(atom (uni_record)) ; for {...}
|
||||||
|
(atom terms: (term)) ; for [...]
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
[
|
[
|
||||||
"]"
|
"]"
|
||||||
"}"
|
"}"
|
||||||
] @indent.branch
|
] @indent.end @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
"]"
|
(comment)
|
||||||
"}"
|
] @indent.auto
|
||||||
] @indent.end
|
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,8 @@
|
||||||
key4 = 4
|
key4 = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# no indent after this line
|
||||||
|
{
|
||||||
|
another = 1
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,6 @@ describe("indent Nickel:", function()
|
||||||
run:new_line("indent-newline.ncl", { on_line = 5, text = "stmt", indent = 2 })
|
run:new_line("indent-newline.ncl", { on_line = 5, text = "stmt", indent = 2 })
|
||||||
run:new_line("indent-newline.ncl", { on_line = 6, text = "stmt", indent = 4 })
|
run:new_line("indent-newline.ncl", { on_line = 6, text = "stmt", indent = 4 })
|
||||||
run:new_line("indent-newline.ncl", { on_line = 7, text = "}", indent = 2 })
|
run:new_line("indent-newline.ncl", { on_line = 7, text = "}", indent = 2 })
|
||||||
|
run:new_line("indent-newline.ncl", { on_line = 11, text = "stmt", indent = 0 })
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue