WIP: Add nushell support

This commit is contained in:
Mikayla 2023-09-05 11:01:55 -07:00
parent 7cc05c99c2
commit ef03e206d6
No known key found for this signature in database
8 changed files with 85 additions and 2 deletions

View file

@ -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"))]

View file

View 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 },
]

View 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