diff --git a/queries/go/indents.scm b/queries/go/indents.scm index a6fbf0824..d88329c99 100644 --- a/queries/go/indents.scm +++ b/queries/go/indents.scm @@ -14,11 +14,12 @@ ] @indent [ - "case" "}" ] @branch (const_declaration ")" @branch) +(import_spec_list ")" @branch) +(var_declaration ")" @branch) [ "}" diff --git a/tests/indent/go/multiple-vars.go b/tests/indent/go/multiple-vars.go new file mode 100644 index 000000000..f89a82e90 --- /dev/null +++ b/tests/indent/go/multiple-vars.go @@ -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 + ) +} diff --git a/tests/indent/go/switch.go b/tests/indent/go/switch.go new file mode 100644 index 000000000..8ccacd564 --- /dev/null +++ b/tests/indent/go/switch.go @@ -0,0 +1,14 @@ +// issue #2166 +package main + +import ( + "fmt" +) + +func test(ch byte) { + fmt.Println("hey!") + switch ch { + case 'l': + return + } +}