Skip to content

Commit 3288c5a

Browse files
authored
feat(nu): added nu support (#537)
* chore: update nvim-treesitter sha Nu was added in: - nvim-treesitter/nvim-treesitter#7267 * feat(nu): added nu support * feat(nu): use context.end * fix(nu): simplify test
1 parent b9e3033 commit 3288c5a

File tree

4 files changed

+93
-1
lines changed

4 files changed

+93
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
NEOVIM_VERSION ?= v0.9.5
44
NEOVIM_RUNNER_VERSION ?= v0.10.0
55

6-
NVIM_TS_SHA ?= 140f534c
6+
NVIM_TS_SHA ?= 894cb3c
77

88
FILTER=.*
99

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Note: support for specific languages is strictly community maintained and can br
160160
- [ ] `mermaid`
161161
- [ ] `meson`
162162
- [ ] `nickel`
163+
- [x] `nu`
163164
- [ ] `ocamllex`
164165
- [ ] `pascal`
165166
- [ ] `perl`

queries/nu/context.scm

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
;; Functions and modules
2+
(decl_def
3+
(_) @context.end
4+
) @context
5+
6+
(decl_module
7+
(_) @context.end
8+
) @context
9+
10+
(decl_export
11+
(_) @context.end
12+
) @context
13+
14+
;; Control flow
15+
(ctrl_if
16+
(_) @context.end
17+
) @context
18+
19+
(ctrl_try
20+
(_) @context.end
21+
) @context
22+
23+
(ctrl_match
24+
(_) @context.end
25+
) @context
26+
27+
(ctrl_for
28+
(_) @context.end
29+
) @context
30+
31+
(ctrl_while
32+
(_) @context.end
33+
) @context
34+
35+
(ctrl_do
36+
(_) @context.end
37+
) @context
38+
39+
(match_arm) @context
40+
(pipe_element) @context
41+
(block) @context
42+
(expr_parenthesized) @context
43+
(val_closure) @context

test/lang/test.nu

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env nu
2+
3+
def foo [] {
4+
# comment
5+
}
6+
7+
module bar {
8+
# comment
9+
}
10+
11+
export-env {
12+
# comment
13+
}
14+
15+
if true {
16+
# comment
17+
}
18+
19+
try {
20+
# comment
21+
} catch {
22+
}
23+
24+
match "A" {
25+
# comment
26+
"A" => "B"
27+
}
28+
29+
for x in 0..10 {
30+
# comment
31+
}
32+
33+
while true {
34+
# comment
35+
}
36+
37+
do {||
38+
print "foo"
39+
# comment
40+
}
41+
42+
let foo = (
43+
ls
44+
| # context
45+
get name
46+
| # context
47+
first
48+
)

0 commit comments

Comments
 (0)