Add JSDoc syntax highlighting support (#7826)

![SCR-20240215-mokn](https://github.com/zed-industries/zed/assets/67913738/17750eb5-bf48-4e23-adc5-0f7a5e15a41b)

Closes #4926

Release Notes:

- Added support for [JSDoc](https://jsdoc.app) syntax highlighting
([#7224](https://github.com/zed-industries/zed/issues/7224)).
This commit is contained in:
Robin Pfäffle 2024-03-15 22:17:06 +01:00 committed by GitHub
parent 24e7cfb0d5
commit eecbafb94e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 37 additions and 0 deletions

10
Cargo.lock generated
View File

@ -5315,6 +5315,7 @@ dependencies = [
"tree-sitter-hcl",
"tree-sitter-heex",
"tree-sitter-html",
"tree-sitter-jsdoc",
"tree-sitter-json 0.20.0",
"tree-sitter-lua",
"tree-sitter-markdown",
@ -10534,6 +10535,15 @@ dependencies = [
"tree-sitter",
]
[[package]]
name = "tree-sitter-jsdoc"
version = "0.20.0"
source = "git+https://github.com/tree-sitter/tree-sitter-jsdoc#6a6cf9e7341af32d8e2b2e24a37fbfebefc3dc55"
dependencies = [
"cc",
"tree-sitter",
]
[[package]]
name = "tree-sitter-json"
version = "0.19.0"

View File

@ -296,6 +296,7 @@ tree-sitter-hcl = { git = "https://github.com/MichaHoffmann/tree-sitter-hcl", re
rustc-demangle = "0.1.23"
tree-sitter-heex = { git = "https://github.com/phoenixframework/tree-sitter-heex", rev = "2e1348c3cf2c9323e87c2744796cf3f3868aa82a" }
tree-sitter-html = "0.19.0"
tree-sitter-jsdoc = { git = "https://github.com/tree-sitter/tree-sitter-jsdoc", ref = "6a6cf9e7341af32d8e2b2e24a37fbfebefc3dc55" }
tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json", rev = "40a81c01a40ac48744e0c8ccabbaba1920441199" }
tree-sitter-lua = "0.0.14"
tree-sitter-markdown = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "330ecab87a3e3a7211ac69bbadc19eabecdb1cca" }

View File

@ -58,6 +58,7 @@ tree-sitter-haskell.workspace = true
tree-sitter-hcl.workspace = true
tree-sitter-heex.workspace = true
tree-sitter-html.workspace = true
tree-sitter-jsdoc.workspace = true
tree-sitter-json.workspace = true
tree-sitter-lua.workspace = true
tree-sitter-markdown.workspace = true

View File

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

View File

@ -0,0 +1,2 @@
("[" @open "]" @close)
("{" @open "}" @close)

View File

@ -0,0 +1,7 @@
name = "JSDoc"
grammar = "jsdoc"
autoclose_before = "]}"
brackets = [
{ start = "{", end = "}", close = true, newline = false },
{ start = "[", end = "]", close = true, newline = false },
]

View File

@ -0,0 +1,2 @@
(tag_name) @keyword
(type) @type

View File

@ -90,6 +90,7 @@ pub fn init(
("hcl", tree_sitter_hcl::language()),
("heex", tree_sitter_heex::language()),
("html", tree_sitter_html::language()),
("jsdoc", tree_sitter_jsdoc::language()),
("json", tree_sitter_json::language()),
("lua", tree_sitter_lua::language()),
("markdown", tree_sitter_markdown::language()),
@ -258,6 +259,7 @@ pub fn init(
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
]
);
language!("jsdoc", vec![Arc::new(deno::DenoLspAdapter::new())]);
}
false => {
language!(
@ -283,6 +285,12 @@ pub fn init(
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
]
);
language!(
"jsdoc",
vec![Arc::new(typescript::TypeScriptLspAdapter::new(
node_runtime.clone(),
))]
);
}
}

View File

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

View File

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