WIP: Add nushell support

This commit is contained in:
Mikayla
2023-09-09 14:01:53 -07:00
parent 7cc05c99c2
commit ef03e206d6
8 changed files with 85 additions and 2 deletions
@@ -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"
}
}
]
+1
View File
@@ -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"
+1
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
@@ -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 },
]
@@ -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