feat(lang): add go.mod and go.work support (#2197)

This commit is contained in:
ttys3 2022-04-21 00:16:02 +08:00 committed by GitHub
parent 8d335f63f0
commit 4144c9d2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 1 deletions

View File

@ -24,6 +24,8 @@
| gleam | ✓ | | | | | gleam | ✓ | | | |
| glsl | ✓ | | ✓ | | | glsl | ✓ | | ✓ | |
| go | ✓ | ✓ | ✓ | `gopls` | | go | ✓ | ✓ | ✓ | `gopls` |
| gomod | ✓ | | | `gopls` |
| gowork | ✓ | | | `gopls` |
| graphql | ✓ | | | | | graphql | ✓ | | | |
| haskell | ✓ | | | `haskell-language-server-wrapper` | | haskell | ✓ | | | `haskell-language-server-wrapper` |
| hcl | ✓ | | ✓ | `terraform-ls` | | hcl | ✓ | | ✓ | `terraform-ls` |

View File

@ -268,6 +268,36 @@ args = { mode = "local", processId = "{0}" }
name = "go" name = "go"
source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75" } source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75" }
[[language]]
name = "gomod"
scope = "source.gomod"
injection-regex = "gomod"
file-types = ["go.mod"]
roots = []
auto-format = true
comment-token = "//"
language-server = { command = "gopls" }
indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "gomod"
source = { git = "https://github.com/camdencheek/tree-sitter-go-mod", rev = "e8f51f8e4363a3d9a427e8f63f4c1bbc5ef5d8d0" }
[[language]]
name = "gowork"
scope = "source.gowork"
injection-regex = "gowork"
file-types = ["go.work"]
roots = []
auto-format = true
comment-token = "//"
language-server = { command = "gopls" }
indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "gowork"
source = { git = "https://github.com/omertuc/tree-sitter-go-work", rev = "6dd9dd79fb51e9f2abc829d5e97b15015b6a8ae2" }
[[language]] [[language]]
name = "javascript" name = "javascript"
scope = "source.js" scope = "source.js"
@ -998,7 +1028,7 @@ file-types = ["kt", "kts"]
roots = ["settings.gradle", "settings.gradle.kts"] roots = ["settings.gradle", "settings.gradle.kts"]
comment-token = "//" comment-token = "//"
indent = { tab-width = 4, unit = " " } indent = { tab-width = 4, unit = " " }
language-server = { command = "kotlin-language-server" } language-server = { command = "kotlin-language-server" }
[[grammar]] [[grammar]]
name = "kotlin" name = "kotlin"

View File

@ -0,0 +1,17 @@
[
"require"
"replace"
"go"
"exclude"
"retract"
"module"
] @keyword
"=>" @operator
(comment) @comment
[
(version)
(go_version)
] @string

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -0,0 +1,14 @@
[
"replace"
"go"
"use"
] @keyword
"=>" @operator
(comment) @comment
[
(version)
(go_version)
] @string

View File

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))