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:
Zheng PiaoDan
2023-05-13 06:03:05 +00:00
committed by GitHub
parent ec0d0ffe51
commit dba8c8e781
3 changed files with 11 additions and 5 deletions

View File

@@ -1,13 +1,13 @@
[
(term)
(atom (uni_record)) ; for {...}
(atom terms: (term)) ; for [...]
] @indent.begin
[
"]"
"}"
] @indent.branch
] @indent.end @indent.branch
[
"]"
"}"
] @indent.end
(comment)
] @indent.auto

View File

@@ -7,3 +7,8 @@
key4 = 4
}
}
# no indent after this line
{
another = 1
}

View File

@@ -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 = 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 = 11, text = "stmt", indent = 0 })
end)
end)