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:
parent
e5fe811d7a
commit
ba91adf48a
7 changed files with 67 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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(),
|
||||
|
|
7
crates/zed/src/languages/gomod/config.toml
Normal file
7
crates/zed/src/languages/gomod/config.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
name = "Go Mod"
|
||||
path_suffixes = ["mod"]
|
||||
line_comments = ["//"]
|
||||
autoclose_before = ")"
|
||||
brackets = [
|
||||
{ start = "(", end = ")", close = true, newline = true}
|
||||
]
|
18
crates/zed/src/languages/gomod/highlights.scm
Normal file
18
crates/zed/src/languages/gomod/highlights.scm
Normal file
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
"require"
|
||||
"replace"
|
||||
"go"
|
||||
"toolchain"
|
||||
"exclude"
|
||||
"retract"
|
||||
"module"
|
||||
] @keyword
|
||||
|
||||
"=>" @operator
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(version)
|
||||
(go_version)
|
||||
] @string
|
29
crates/zed/src/languages/gomod/structure.scm
Normal file
29
crates/zed/src/languages/gomod/structure.scm
Normal 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
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue