diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a1746c4c..ef3c9451 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -24,6 +24,8 @@ | gleam | ✓ | | | | | glsl | ✓ | | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | +| gomod | ✓ | | | `gopls` | +| gowork | ✓ | | | `gopls` | | graphql | ✓ | | | | | haskell | ✓ | | | `haskell-language-server-wrapper` | | hcl | ✓ | | ✓ | `terraform-ls` | diff --git a/languages.toml b/languages.toml index fdf794a6..76b4ca16 100644 --- a/languages.toml +++ b/languages.toml @@ -268,6 +268,36 @@ args = { mode = "local", processId = "{0}" } name = "go" 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]] name = "javascript" scope = "source.js" @@ -998,7 +1028,7 @@ file-types = ["kt", "kts"] roots = ["settings.gradle", "settings.gradle.kts"] comment-token = "//" indent = { tab-width = 4, unit = " " } -language-server = { command = "kotlin-language-server" } +language-server = { command = "kotlin-language-server" } [[grammar]] name = "kotlin" diff --git a/runtime/queries/gomod/highlights.scm b/runtime/queries/gomod/highlights.scm new file mode 100644 index 00000000..63e1f012 --- /dev/null +++ b/runtime/queries/gomod/highlights.scm @@ -0,0 +1,17 @@ +[ + "require" + "replace" + "go" + "exclude" + "retract" + "module" +] @keyword + +"=>" @operator + +(comment) @comment + +[ +(version) +(go_version) +] @string diff --git a/runtime/queries/gomod/injections.scm b/runtime/queries/gomod/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/gomod/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/gowork/highlights.scm b/runtime/queries/gowork/highlights.scm new file mode 100644 index 00000000..9c84bcc4 --- /dev/null +++ b/runtime/queries/gowork/highlights.scm @@ -0,0 +1,14 @@ +[ + "replace" + "go" + "use" +] @keyword + +"=>" @operator + +(comment) @comment + +[ +(version) +(go_version) +] @string diff --git a/runtime/queries/gowork/injections.scm b/runtime/queries/gowork/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/gowork/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment"))