on master help sign in
feat(lang): add go.mod and go.work support (#2197)
4144c9dttys3
book/src/generated/lang-support.md+2
@@ -24,6 +24,8 @@
24| gleam | ✓ | | | |
24| gleam | ✓ | | | |
25| glsl | ✓ | | ✓ | |
25| glsl | ✓ | | ✓ | |
26| go | ✓ | ✓ | ✓ | `gopls` |
26| go | ✓ | ✓ | ✓ | `gopls` |
27+| gomod | ✓ | | | `gopls` |
28+| gowork | ✓ | | | `gopls` |
27| graphql | ✓ | | | |
29| graphql | ✓ | | | |
28| haskell | ✓ | | | `haskell-language-server-wrapper` |
30| haskell | ✓ | | | `haskell-language-server-wrapper` |
29| hcl | ✓ | | ✓ | `terraform-ls` |
31| hcl | ✓ | | ✓ | `terraform-ls` |
languages.toml+31−1
@@ -268,6 +268,36 @@ args = { mode = "local", processId = "{0}" }
268name = "go"
268name = "go"
269source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75" }
269source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75" }
270
270
271+[[language]]
272+name = "gomod"
273+scope = "source.gomod"
274+injection-regex = "gomod"
275+file-types = ["go.mod"]
276+roots = []
277+auto-format = true
278+comment-token = "//"
279+language-server = { command = "gopls" }
280+indent = { tab-width = 4, unit = "\t" }
281+
282+[[grammar]]
283+name = "gomod"
284+source = { git = "https://github.com/camdencheek/tree-sitter-go-mod", rev = "e8f51f8e4363a3d9a427e8f63f4c1bbc5ef5d8d0" }
285+
286+[[language]]
287+name = "gowork"
288+scope = "source.gowork"
289+injection-regex = "gowork"
290+file-types = ["go.work"]
291+roots = []
292+auto-format = true
293+comment-token = "//"
294+language-server = { command = "gopls" }
295+indent = { tab-width = 4, unit = "\t" }
296+
297+[[grammar]]
298+name = "gowork"
299+source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd79fb51e9f2abc829d5e97b15015b6a8ae2" }
300+
271[[language]]
301[[language]]
272name = "javascript"
302name = "javascript"
273scope = "source.js"
303scope = "source.js"
@@ -998,7 +1028,7 @@ file-types = ["kt", "kts"]
998roots = ["settings.gradle", "settings.gradle.kts"]
1028roots = ["settings.gradle", "settings.gradle.kts"]
999comment-token = "//"
1029comment-token = "//"
1000indent = { tab-width = 4, unit = " " }
1030indent = { tab-width = 4, unit = " " }
1001−language-server = { command = "kotlin-language-server" }
1031+language-server = { command = "kotlin-language-server" }
1002
1032
1003[[grammar]]
1033[[grammar]]
1004name = "kotlin"
1034name = "kotlin"
runtime/queries/gomod/highlights.scmnew file+17
@@ -0,0 +1,17 @@
1+[
2+ "require"
3+ "replace"
4+ "go"
5+ "exclude"
6+ "retract"
7+ "module"
8+] @keyword
9+
10+"=>" @operator
11+
12+(comment) @comment
13+
14+[
15+(version)
16+(go_version)
17+] @string
runtime/queries/gomod/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/gowork/highlights.scmnew file+14
@@ -0,0 +1,14 @@
1+[
2+ "replace"
3+ "go"
4+ "use"
5+] @keyword
6+
7+"=>" @operator
8+
9+(comment) @comment
10+
11+[
12+(version)
13+(go_version)
14+] @string
runtime/queries/gowork/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))