mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
WIP: Add nushell support
This commit is contained in:
parent
7cc05c99c2
commit
ef03e206d6
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -8406,6 +8406,15 @@ dependencies = [
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-nu"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/mikayla-maki/tree-sitter-nu/?rev=6cf9ee39ceb3da79501de7646b10e5e1da800ab8#6cf9ee39ceb3da79501de7646b10e5e1da800ab8"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-php"
|
||||
version = "0.19.1"
|
||||
@ -9868,6 +9877,7 @@ dependencies = [
|
||||
"tree-sitter-lua",
|
||||
"tree-sitter-markdown",
|
||||
"tree-sitter-nix",
|
||||
"tree-sitter-nu",
|
||||
"tree-sitter-php",
|
||||
"tree-sitter-python",
|
||||
"tree-sitter-racket",
|
||||
|
@ -141,6 +141,7 @@ tree-sitter-racket = { git = "https://github.com/zed-industries/tree-sitter-rack
|
||||
tree-sitter-yaml = { git = "https://github.com/zed-industries/tree-sitter-yaml", rev = "f545a41f57502e1b5ddf2a6668896c1b0620f930"}
|
||||
tree-sitter-lua = "0.0.14"
|
||||
tree-sitter-nix = { git = "https://github.com/nix-community/tree-sitter-nix", rev = "66e3e9ce9180ae08fc57372061006ef83f0abde7" }
|
||||
tree-sitter-nu = { git = "https://github.com/mikayla-maki/tree-sitter-nu/", rev = "6cf9ee39ceb3da79501de7646b10e5e1da800ab8"}
|
||||
|
||||
[patch.crates-io]
|
||||
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "35a6052fbcafc5e5fc0f9415b8652be7dcaf7222" }
|
||||
|
@ -42,8 +42,8 @@
|
||||
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "0af9125c4eae12a4973fb66574c53a54962a9e1e",
|
||||
"version": "1.21.0"
|
||||
"revision": "ce20dc083ee485524b802669890291c0d8090170",
|
||||
"version": "1.22.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -132,6 +132,7 @@ tree-sitter-racket.workspace = true
|
||||
tree-sitter-yaml.workspace = true
|
||||
tree-sitter-lua.workspace = true
|
||||
tree-sitter-nix.workspace = true
|
||||
tree-sitter-nu.workspace = true
|
||||
|
||||
url = "2.2"
|
||||
urlencoding = "2.1.2"
|
||||
|
@ -170,6 +170,7 @@ pub fn init(languages: Arc<LanguageRegistry>, node_runtime: Arc<dyn NodeRuntime>
|
||||
language("elm", tree_sitter_elm::language(), vec![]);
|
||||
language("glsl", tree_sitter_glsl::language(), vec![]);
|
||||
language("nix", tree_sitter_nix::language(), vec![]);
|
||||
language("nu", tree_sitter_nu::language(), vec![]);
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
0
crates/zed/src/languages/nushell.rs
Normal file
0
crates/zed/src/languages/nushell.rs
Normal file
9
crates/zed/src/languages/nushell/config.toml
Normal file
9
crates/zed/src/languages/nushell/config.toml
Normal file
@ -0,0 +1,9 @@
|
||||
name = "Nu"
|
||||
path_suffixes = ["nu"]
|
||||
line_comment = "# "
|
||||
autoclose_before = ";:.,=}])>` \n\t\""
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
]
|
61
crates/zed/src/languages/nushell/highlights.scm
Normal file
61
crates/zed/src/languages/nushell/highlights.scm
Normal file
@ -0,0 +1,61 @@
|
||||
(string) @string
|
||||
(type) @type
|
||||
(value_path) @variable
|
||||
(comment) @comment
|
||||
|
||||
(number_literal) @number
|
||||
(range from: (number_literal) @number)
|
||||
(range to: (number_literal) @number)
|
||||
|
||||
(command cmd_name: (identifier) @function)
|
||||
(function_definition func_name: (identifier) @function)
|
||||
|
||||
[
|
||||
(variable_declaration name: (identifier))
|
||||
(parameter (identifier))
|
||||
(flag (flag_name))
|
||||
(flag (flag_shorthand_name))
|
||||
(record_entry entry_name: (identifier))
|
||||
(block_args block_param: (identifier))
|
||||
] @property
|
||||
; (parameter (identifier) @variable.parameter) ; -- alternative highlighting group?
|
||||
|
||||
(cmd_invocation) @embedded
|
||||
|
||||
|
||||
((identifier) @constant
|
||||
(.match? @constant "^[A-Z][A-Z\\d_]*$"))
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"not"
|
||||
"let"
|
||||
"def"
|
||||
"def-env"
|
||||
"export"
|
||||
"true"
|
||||
"false"
|
||||
"and"
|
||||
"or"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
; "/" Not making / an operator may lead to better highlighting?
|
||||
"$"
|
||||
"|"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"="
|
||||
"!="
|
||||
"and"
|
||||
"or"
|
||||
"=="
|
||||
">"
|
||||
] @operator
|
||||
|
||||
["."
|
||||
","
|
||||
";"
|
||||
] @delimiter
|
Loading…
Reference in New Issue
Block a user