aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-08-05 21:04:21 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-08-05 12:32:20 -0700
commit27424a2040efac021d6d86e14588c3998af99ccd (patch)
treea570fc86cd8ae9c3d025f23780fcea04e965cd66 /tests/indent
parentSQL highlight queries rely on latest parser AST (diff)
downloadnvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar.gz
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar.bz2
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar.lz
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar.xz
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.tar.zst
nvim-treesitter-27424a2040efac021d6d86e14588c3998af99ccd.zip
indents(go): improve `@branch` rules
- Don't branch at `case` - Let `import_spec_list`/`var_declaration` behave like `const_declaration` Fixes #2166
Diffstat (limited to 'tests/indent')
-rw-r--r--tests/indent/go/multiple-vars.go19
-rw-r--r--tests/indent/go/switch.go14
2 files changed, 33 insertions, 0 deletions
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
+ }
+}