Skip to content

Commit 7c5e12a

Browse files
author
fidgetingbits
committed
Add inside support for maps and lists
1 parent 85e0775 commit 7c5e12a

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: change inside list
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- {type: interiorOnly}
11+
- type: containingScope
12+
scopeType: {type: list}
13+
usePrePhraseSnapshot: true
14+
initialState:
15+
documentContents: |
16+
{
17+
foo = [ 1 2 3 ];
18+
}
19+
selections:
20+
- anchor: {line: 1, character: 11}
21+
active: {line: 1, character: 11}
22+
marks: {}
23+
finalState:
24+
documentContents: |
25+
{
26+
foo = [ ];
27+
}
28+
selections:
29+
- anchor: {line: 1, character: 10}
30+
active: {line: 1, character: 10}
31+
ide:
32+
messages:
33+
- {type: error, id: TreeSitterQuery.checkCaptures.duplicate}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
languageId: nix
2+
command:
3+
version: 6
4+
spokenForm: chuck inside map
5+
action:
6+
name: remove
7+
target:
8+
type: primitive
9+
modifiers:
10+
- {type: interiorOnly}
11+
- type: containingScope
12+
scopeType: {type: map}
13+
usePrePhraseSnapshot: true
14+
initialState:
15+
documentContents: |
16+
{
17+
foo = if a
18+
then b
19+
else c;
20+
}
21+
selections:
22+
- anchor: {line: 3, character: 9}
23+
active: {line: 3, character: 9}
24+
marks: {}
25+
finalState:
26+
documentContents: |
27+
{
28+
29+
}
30+
selections:
31+
- anchor: {line: 1, character: 2}
32+
active: {line: 1, character: 2}

Diff for: queries/nix.scm

+14-3
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,27 @@
8888
;;
8989

9090
;;!! foo = [ a b c ];
91-
;;! ^^^^^^^^^
91+
;;! ^
92+
;;! xx
9293
(list_expression
9394
element: (_) @collectionItem
95+
)
96+
97+
;;!! foo = [ a b c ];
98+
;;! ^^^^^^^^^
99+
(list_expression
100+
element: (_)+ @list.interior
94101
) @list
95102

96103
;;!! foo = { x = 1; y = 2; };
97104
;;! ^^^^^^^^^^^^^^^^^
98105
[
99-
(attrset_expression)
100-
(rec_attrset_expression)
106+
(attrset_expression
107+
(_) @map.interior
108+
)
109+
(rec_attrset_expression
110+
(_) @map.interior
111+
)
101112
] @map @statement.iteration @value.iteration @name.iteration
102113

103114
;;!! foo = { x = 1; y = 2; };

0 commit comments

Comments
 (0)