mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 08:50:11 -04:00
fix(go): indent const declaration
https://github.com/nvim-treesitter/nvim-treesitter/issues/3104
This commit is contained in:
parent
dcc5895e7c
commit
6eb35103d0
3 changed files with 12 additions and 4 deletions
|
|
@ -18,6 +18,8 @@
|
||||||
"}"
|
"}"
|
||||||
] @branch
|
] @branch
|
||||||
|
|
||||||
|
(const_declaration ")" @branch)
|
||||||
|
|
||||||
[
|
[
|
||||||
"}"
|
"}"
|
||||||
")"
|
")"
|
||||||
|
|
|
||||||
7
tests/indent/go/const_declaration.go
Normal file
7
tests/indent/go/const_declaration.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
const (
|
||||||
|
ExampleOne = iota
|
||||||
|
ExampleTwo
|
||||||
|
ExampleThree
|
||||||
|
)
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue