Skip to content
Merged
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 extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/zed-extensions/nu"

[grammars.nu]
repository = "https://github.com/nushell/tree-sitter-nu"
commit = "47d4b4f5369c0cae866724758ae88ef07e10e4f1"
commit = "0c3f6dfbc30d7713dcbb15b10954f2dee86ef63c"

[language_servers.nu]
languages = ["Nu"]
Expand Down
3 changes: 3 additions & 0 deletions languages/nu/brackets.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
("{" @open
"}" @close)

("<" @open
">" @close)

(parameter_pipes
"|" @open
"|" @close)
1 change: 1 addition & 0 deletions languages/nu/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ brackets = [
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = true },
{ start = "<", end = ">", close = false, newline = true },
]
51 changes: 35 additions & 16 deletions languages/nu/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"let"
"mut"
"const"
"type"
] @keyword

[
Expand All @@ -25,6 +26,7 @@
[
"try"
"catch"
"finally"
"error"
] @keyword.exception

Expand Down Expand Up @@ -263,7 +265,7 @@ key: (identifier) @property

(cmd_identifier) @function

; generated with Nu 0.107.0
; generated with Nu 0.117.0
; help commands
; | where $it.command_type == built-in and $it.category != core
; | each {$'"($in.name | split row " " | $in.0)"'}
Expand All @@ -272,27 +274,29 @@ key: (identifier) @property
(command
head: (cmd_identifier) @function.builtin
(#any-of? @function.builtin
"all" "ansi" "any" "append" "ast" "bits" "bytes" "cal" "cd" "char" "chunk-by" "chunks" "clear"
"collect" "columns" "compact" "complete" "config" "cp" "date" "debug" "decode" "default"
"detect" "drop" "du" "each" "encode" "enumerate" "every" "exec" "exit" "explain" "explore"
"fill" "filter" "find" "first" "flatten" "format" "from" "generate" "get" "glob" "grid"
"group-by" "hash" "headers" "histogram" "history" "http" "input" "insert" "inspect" "interleave"
"into" "is-empty" "is-not-empty" "is-terminal" "items" "job" "join" "keybindings" "kill" "last"
"length" "let-env" "lines" "load-env" "ls" "math" "merge" "metadata" "mkdir" "mktemp" "move"
"mv" "nu-check" "nu-highlight" "open" "panic" "par-each" "parse" "path" "plugin" "port"
"prepend" "print" "ps" "query" "random" "reduce" "reject" "rename" "reverse" "rm" "roll"
"rotate" "run-external" "save" "schema" "select" "seq" "shuffle" "skip" "sleep" "slice" "sort"
"abbr" "all" "ansi" "any" "append" "ast" "bits" "bytes" "cal" "cd" "char" "chunk-by" "chunks"
"clear" "columns" "combinations" "compact" "complete" "config" "cp" "date" "debug" "decode"
"default" "detect" "difference" "drop" "du" "each" "encode" "enumerate" "every" "exec" "exit"
"explain" "explore" "fill" "find" "first" "flatten" "format" "from" "generate" "get" "glob"
"grid" "group-by" "hash" "headers" "histogram" "history" "http" "idx" "input" "insert" "inspect"
"interleave" "intersect" "into" "is-empty" "is-not-empty" "is-redirected" "is-terminal" "items"
"job" "join" "keybindings" "kill" "last" "length" "lines" "load-env" "ls" "math" "matrix"
"merge" "metadata" "mkdir" "mktemp" "move" "mv" "nu-check" "nu-highlight" "open" "panic"
"par-each" "parse" "path" "peek" "permutations" "plugin" "port" "prepend" "print" "ps" "query"
"random" "record" "reduce" "reject" "rename" "reverse" "rm" "roll" "rotate" "run-external"
"run-internal" "save" "schema" "select" "semver" "seq" "shuffle" "skip" "sleep" "slice" "sort"
"sort-by" "split" "start" "stor" "str" "sys" "table" "take" "tee" "term" "timeit" "to" "touch"
"transpose" "tutor" "ulimit" "uname" "uniq" "uniq-by" "update" "upsert" "url" "values" "version"
"view" "watch" "which" "whoami" "window" "with-env" "wrap" "zip"))
"transpose" "tui" "tutor" "ulimit" "umask" "uname" "union" "uniq" "uniq-by" "unlet" "update"
"upsert" "url" "values" "version" "view" "watch" "which" "whoami" "window" "with-env" "wrap"
"zip"))

(command
head: (cmd_identifier) @keyword.repeat
(#any-of? @keyword.repeat "break" "continue" "return"))

(command
head: (cmd_identifier) @keyword
(#any-of? @keyword "do" "source" "source-env" "hide" "hide-env"))
(#any-of? @keyword "do" "source" "source-env" "hide" "hide-env" "collect" "run"))

(command
head: (cmd_identifier) @keyword
Expand All @@ -307,10 +311,18 @@ key: (identifier) @property
(#eq? @keyword "as"))

(command
"^" @punctuation.delimiter
[
"^"
"%"
] @punctuation.delimiter
head: (_) @function)

"where" @function.builtin
(where_command
[
"where"
"any"
"all"
] @function.builtin)

(where_predicate
[
Expand Down Expand Up @@ -338,6 +350,10 @@ key: (identifier) @property
"env" @constant
]) @none

(val_variable
name: (identifier) @special
(#eq? @special "ans"))

(val_cellpath
"$" @punctuation.special)

Expand All @@ -348,6 +364,9 @@ key: (identifier) @property
; types
(flat_type) @type

(decl_type
name: (_) @type.definition)

(list_type
"list" @type.enum
[
Expand Down
Loading