Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/rust/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,13 @@ module.exports = grammar({
'key',
choice(
alias($._unquoted_in_record, $.identifier),
alias($.val_string, $.identifier),
$.val_string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for this change?

),
),
optional($._collection_annotation),
),
_collection_body: ($) =>
general_body_rules(
'',
$._collection_entry,
$._entry_separator,
$._newline,
),
_collection_body: ($) => repeat1(choice( ',', $._collection_entry, '\n')),
Copy link
Contributor

@blindFS blindFS Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to take care of \r as well, but this is truly a lot better. I don't recall what I was thinking (could be some irrelevant nuances) back then, LoL.


collection_type: ($) =>
seq(
choice('record', 'table'),
Expand Down
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
"node-gyp-build": "^4.8.4"
},
"devDependencies": {
"eslint": "^9.36.0",
"eslint-config-prettier": "^10.1.8",
"eslint-config-treesitter": "^1.0.2",
"prebuildify": "^6.0.1",
"prettier": "^3.6.2",
"tree-sitter-cli": "^0.25.9"
"tree-sitter": "^0.22.4",
"tree-sitter-cli": "^0.25.10"
},
"peerDependencies": {
"tree-sitter": "^0.25.0"
"tree-sitter": "^0.22.4"
},
"peerDependenciesMeta": {
"tree-sitter": {
Expand All @@ -49,8 +46,6 @@
"install": "node-gyp-build",
"prestart": "tree-sitter build --wasm",
"start": "tree-sitter playground",
"test": "node --test bindings/node/*_test.js",
"lint": "eslint grammar.js",
"format": "prettier --check ."
"test": "node --test bindings/node/*_test.js"
}
}
87 changes: 35 additions & 52 deletions queries/nu/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
] @keyword.repeat

"def" @keyword.function
(string_content) @string

[
"try"
Expand Down Expand Up @@ -62,7 +63,6 @@
] @number
"[" @punctuation.bracket
digit: [
"," @punctuation.delimiter
(hex_digit) @number
]
"]" @punctuation.bracket) @number
Expand Down Expand Up @@ -143,37 +143,42 @@ file_path: (val_string) @variable.parameter
] @operator

[
"o>"
"out>"
"e>"
"err>"
"e+o>"
"err+out>"
"o+e>"
"out+err>"
"o>>"
"out>>"
"e>>"
"err>>"
"e+o>>"
"err+out>>"
"o+e>>"
"out+err>>"
"e>|"
"err>|"
"e+o>|"
"e>"
"e>>"
"e>|"
"err+out>"
"err+out>>"
"err+out>|"
"err>"
"err>>"
"err>|"
"o+e>"
"o+e>>"
"o+e>|"
"o>"
"o>>"
"out+err>"
"out+err>>"
"out+err>|"
"out>"
"out>>"
] @operator

; ---
; punctuation
[
","
";"
] @punctuation.special

[
","
":"
"->"
] @punctuation.delimiter

(param_long_flag
"--" @punctuation.delimiter)

Expand All @@ -195,34 +200,30 @@ file_path: (val_string) @variable.parameter
(param_rest
"..." @punctuation.delimiter)

(param_type
":" @punctuation.special)

(param_value
"=" @punctuation.special)

(param_completer
"@" @punctuation.special)

(attribute
"@" @punctuation.special)
"@" @label)

(param_opt
"?" @punctuation.special)

(returns
"->" @punctuation.special)

[
"("
")"
"{"
"}"
"["
"]"
"...["
"...("
"...["
"...{"
"<"
">"
"["
"]"
"{"
"}"
] @punctuation.bracket

key: (identifier) @property
Expand Down Expand Up @@ -304,7 +305,7 @@ key: (identifier) @property
(#eq? @keyword "as"))

(command
"^" @punctuation.delimiter
"^" @keyword.modifier
head: (_) @function)

"where" @function.builtin
Expand Down Expand Up @@ -338,21 +339,16 @@ key: (identifier) @property
(val_cellpath
"$" @punctuation.special)

(record_entry
":" @punctuation.special)

; ---
; types
(flat_type) @type

(list_type
"list" @type.enum
[
"<"
">"
] @punctuation.bracket)
"list" @type)

(collection_type
.
[
"record"
"table"
Expand All @@ -361,21 +357,8 @@ key: (identifier) @property
(collection_type
key: (_) @variable.parameter)

(collection_type
[
"<"
">"
] @punctuation.bracket)

(collection_type
":" @punctuation.special)

(composite_type
"oneof" @type.enum
[
"<"
">"
] @punctuation.bracket)
"oneof" @type.enum)

(shebang) @keyword.directive

Expand Down
47 changes: 8 additions & 39 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 9 additions & 19 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading