languages: add highlighting for go.mod (#7137)

Release Notes:

- Added syntax highlighting for go.mod files. Fixes #7133 

<img width="863" alt="image"
src="https://github.com/zed-industries/zed/assets/8725798/dc521a02-c53a-44aa-b0c1-eebf31835679">
This commit is contained in:
Derrick Laird 2024-01-31 00:46:13 -07:00 committed by GitHub
parent e5fe811d7a
commit ba91adf48a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 67 additions and 0 deletions

View file

@ -115,6 +115,7 @@ tree-sitter-embedded-template.workspace = true
tree-sitter-gleam.workspace = true
tree-sitter-glsl.workspace = true
tree-sitter-go.workspace = true
tree-sitter-gomod.workspace = true
tree-sitter-haskell.workspace = true
tree-sitter-heex.workspace = true
tree-sitter-html.workspace = true

View file

@ -122,6 +122,7 @@ pub fn init(
tree_sitter_go::language(),
vec![Arc::new(go::GoLspAdapter)],
);
language("gomod", tree_sitter_gomod::language(), vec![]);
language(
"zig",
tree_sitter_zig::language(),

View file

@ -0,0 +1,7 @@
name = "Go Mod"
path_suffixes = ["mod"]
line_comments = ["//"]
autoclose_before = ")"
brackets = [
{ start = "(", end = ")", close = true, newline = true}
]

View file

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

View file

@ -0,0 +1,29 @@
(require_directive
"require" @structure.anchor
("(") @structure.open
(")") @structure.close
)
(exclude_directive
"exclude" @structure.anchor
("(") @structure.open
(")") @structure.close
)
(module_directive
"module" @structure.anchor
("(") @structure.open
(")") @structure.close
)
(replace_directive
"replace" @structure.anchor
("(") @structure.open
(")") @structure.close
)
(retract_directive
"retract" @structure.anchor
("(") @structure.open
(")") @structure.close
)