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 languages.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
extensions = ["nu"],
grammar.source.git = {
git = "https://github.com/nushell/tree-sitter-nu.git",
rev = "d9d6ad2c836bc3bd5010ab7850bc6da9498ca576",
rev = "74ff80b2cff6d68286747a3de45531965ad2cf38",
},
},
},
Expand Down
19 changes: 4 additions & 15 deletions languages/nu.scm
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@
entry: _ @prepend_spaced_softline
)

;; match_arm
(val_list
(record_body
entry: _ @append_space
.
entry: _ @prepend_spaced_softline
)

;; match_arm
(val_list
entry: _
(list_body)
.
rest: _ @prepend_spaced_softline
)
Expand All @@ -305,18 +305,7 @@
row: _ @prepend_spaced_softline
)

(val_record
entry: _ @append_space
.
entry: _ @prepend_spaced_softline
)

(record_body
entry: (record_entry) @append_space
.
entry: (record_entry) @prepend_spaced_softline
)

;; type notation
(collection_type
[
type: _
Expand Down
3 changes: 3 additions & 0 deletions test/expected_ctrl.nu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ match $foo {
match $foo {
[a b c] => 0
a | b | c => 42
a
| b
| c => 42
{$bar $baz} => $baz
# ..rest pattern
[$x ..$y] if $x == 1 => { 'good list' }
Expand Down
6 changes: 4 additions & 2 deletions test/input_ctrl.nu
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ match $foo {
_ => {exit 0}
}
match $foo {
[ a b c] => 0
[ a b, c] => 0
a|b|c => 42
a
|b|c => 42
{ $bar $baz} => $baz
# ..rest pattern
[ $x ..$y ] if $x == 1 => { 'good list' }
[ $x , ..$y ] if $x == 1 => { 'good list' }
[ ..$y] => { $y }
}
match $foo {null => {return "default"} $val => $val}
Expand Down