fix(go): indent const declaration

https://github.com/nvim-treesitter/nvim-treesitter/issues/3104
This commit is contained in:
kiyan 2022-07-02 12:47:05 +02:00 committed by Stephan Seitz
parent dcc5895e7c
commit 6eb35103d0
3 changed files with 12 additions and 4 deletions

View file

@ -18,6 +18,8 @@
"}" "}"
] @branch ] @branch
(const_declaration ")" @branch)
[ [
"}" "}"
")" ")"

View file

@ -0,0 +1,7 @@
package main
const (
ExampleOne = iota
ExampleTwo
ExampleThree
)

View file

@ -15,11 +15,10 @@ describe("indent Go:", function()
}) })
end) end)
describe("new line:", function() describe("new lines:", function()
run:new_line("issue-2369.go", { on_line = 13, text = "// some comment", indent = 1 }) run:new_line("issue-2369.go", { on_line = 13, text = "// some comment", indent = 1 })
end)
describe("new line after )/}:", function()
run:new_line("issue-2369-newline.go", { on_line = 8, text = "// comment", indent = 0 }) run:new_line("issue-2369-newline.go", { on_line = 8, text = "// comment", indent = 0 })
run:new_line("const_declaration.go", { on_line = 3, text = "Constant", indent = 1 })
run:new_line("const_declaration.go", { on_line = 7, text = "func main() {", indent = 0 })
end) end)
end) end)