WIP: Add nushell support
This commit is contained in:
parent
7cc05c99c2
commit
ef03e206d6
8 changed files with 85 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue