mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
indents(go): improve @branch rules
- Don't branch at `case` - Let `import_spec_list`/`var_declaration` behave like `const_declaration` Fixes #2166
This commit is contained in:
parent
3832fde3ee
commit
27424a2040
3 changed files with 35 additions and 1 deletions
|
|
@ -14,11 +14,12 @@
|
||||||
] @indent
|
] @indent
|
||||||
|
|
||||||
[
|
[
|
||||||
"case"
|
|
||||||
"}"
|
"}"
|
||||||
] @branch
|
] @branch
|
||||||
|
|
||||||
(const_declaration ")" @branch)
|
(const_declaration ")" @branch)
|
||||||
|
(import_spec_list ")" @branch)
|
||||||
|
(var_declaration ")" @branch)
|
||||||
|
|
||||||
[
|
[
|
||||||
"}"
|
"}"
|
||||||
|
|
|
||||||
19
tests/indent/go/multiple-vars.go
Normal file
19
tests/indent/go/multiple-vars.go
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
var (
|
||||||
|
thing = 1
|
||||||
|
thingTwo = 2
|
||||||
|
) // <-- This paren should be at 0 instead of indented
|
||||||
|
|
||||||
|
var (
|
||||||
|
thing = 1
|
||||||
|
thingTwo = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// It should be
|
||||||
|
var (
|
||||||
|
thing = 1
|
||||||
|
thingTwo = 2
|
||||||
|
)
|
||||||
|
}
|
||||||
14
tests/indent/go/switch.go
Normal file
14
tests/indent/go/switch.go
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// issue #2166
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func test(ch byte) {
|
||||||
|
fmt.Println("hey!")
|
||||||
|
switch ch {
|
||||||
|
case 'l':
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue