Skip to content

Commit dda1cdd

Browse files
author
fidgetingbits
committed
basic value support and tests
1 parent 46a6780 commit dda1cdd

File tree

7 files changed

+252
-2
lines changed

7 files changed

+252
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: change value
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 1, character: 7}
27+
active: {line: 1, character: 7}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo = ;
33+
34+
}
35+
selections:
36+
- anchor: {line: 1, character: 8}
37+
active: {line: 1, character: 8}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: change value
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 2, character: 4}
27+
active: {line: 2, character: 4}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo = let
33+
a = ;
34+
c = d;
35+
in
36+
{
37+
output = b;
38+
};
39+
40+
}
41+
selections:
42+
- anchor: {line: 2, character: 8}
43+
active: {line: 2, character: 8}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: change value
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 5, character: 5}
27+
active: {line: 5, character: 5}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo = ;
33+
34+
}
35+
selections:
36+
- anchor: {line: 1, character: 8}
37+
active: {line: 1, character: 8}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: change value
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 6, character: 13}
27+
active: {line: 6, character: 13}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo = let
33+
a = b;
34+
c = d;
35+
in
36+
{
37+
output = ;
38+
};
39+
40+
}
41+
selections:
42+
- anchor: {line: 6, character: 15}
43+
active: {line: 6, character: 15}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: chuck value
5+
action:
6+
name: remove
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 1, character: 7}
27+
active: {line: 1, character: 7}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo;
33+
34+
}
35+
selections:
36+
- anchor: {line: 1, character: 5}
37+
active: {line: 1, character: 5}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: chuck value
5+
action:
6+
name: remove
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: containingScope
11+
scopeType: {type: value}
12+
usePrePhraseSnapshot: true
13+
initialState:
14+
documentContents: |
15+
{
16+
foo = let
17+
a = b;
18+
c = d;
19+
in
20+
{
21+
output = b;
22+
};
23+
24+
}
25+
selections:
26+
- anchor: {line: 2, character: 4}
27+
active: {line: 2, character: 4}
28+
marks: {}
29+
finalState:
30+
documentContents: |
31+
{
32+
foo = let
33+
a;
34+
c = d;
35+
in
36+
{
37+
output = b;
38+
};
39+
40+
}
41+
selections:
42+
- anchor: {line: 2, character: 4}
43+
active: {line: 2, character: 4}

queries/nix.scm

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
[
2222
(attrset_expression)
2323
(rec_attrset_expression)
24-
] @map @statement.iteration
24+
] @map @statement.iteration @value.iteration
2525
(binding_set) @map.iteration @list.iteration @ifStatement.iteration
2626

2727
(source_code) @statement.iteration @map.iteration
@@ -34,7 +34,7 @@
3434
;;!! in a + b
3535
(let_expression
3636
"let"
37-
(_) @statement.iteration
37+
(_) @statement.iteration @value.iteration
3838
)
3939

4040
(string_expression
@@ -83,3 +83,13 @@
8383
(apply_expression) @functionCall
8484
(formals) @argumentOrParameter.iteration
8585
(formal) @argumentOrParameter
86+
87+
;;!! a = 25;
88+
;;! ^^
89+
;;! xxxxx
90+
;;! ------
91+
(binding
92+
(_) @_.leading.start.endOf
93+
.
94+
expression: (_) @value @_.leading.end.startOf
95+
) @_.domain

0 commit comments

Comments
 (0)