Skip to content

Commit 5a93b81

Browse files
committed
Fixes
1 parent d963952 commit 5a93b81

File tree

5 files changed

+148
-34
lines changed

5 files changed

+148
-34
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
languageId: python
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+
if (x := 0) < 1:
16+
pass
17+
selections:
18+
- anchor: {line: 0, character: 4}
19+
active: {line: 0, character: 4}
20+
marks: {}
21+
finalState:
22+
documentContents: |-
23+
if (x := ) < 1:
24+
pass
25+
selections:
26+
- anchor: {line: 0, character: 9}
27+
active: {line: 0, character: 9}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
languageId: python
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+
match aaa:
16+
case {"bbb": ccc}:
17+
pass
18+
selections:
19+
- anchor: {line: 1, character: 10}
20+
active: {line: 1, character: 10}
21+
marks: {}
22+
finalState:
23+
documentContents: |-
24+
match aaa:
25+
case {"bbb": }:
26+
pass
27+
selections:
28+
- anchor: {line: 1, character: 17}
29+
active: {line: 1, character: 17}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
languageId: python
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+
if (x := 0) < 1:
16+
pass
17+
selections:
18+
- anchor: {line: 0, character: 4}
19+
active: {line: 0, character: 4}
20+
marks: {}
21+
finalState:
22+
documentContents: |-
23+
if (x ) < 1:
24+
pass
25+
selections:
26+
- anchor: {line: 0, character: 4}
27+
active: {line: 0, character: 4}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
languageId: python
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+
match aaa:
16+
case {"bbb": ccc}:
17+
pass
18+
selections:
19+
- anchor: {line: 1, character: 10}
20+
active: {line: 1, character: 10}
21+
marks: {}
22+
finalState:
23+
documentContents: |-
24+
match aaa:
25+
case {"bbb"}:
26+
pass
27+
selections:
28+
- anchor: {line: 1, character: 10}
29+
active: {line: 1, character: 10}

queries/python.scm

+36-34
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
(with_statement)
2828
] @statement
2929

30-
;; a = 25
31-
;; ^^
32-
;; xxxx
33-
;; ------
30+
;;!! a = 25
31+
;;! ^^
32+
;;! xxxx
33+
;;! ------
3434
(
3535
(assignment
3636
[
@@ -40,10 +40,10 @@
4040
) @_.domain
4141
)
4242

43-
;; a /= 25
44-
;; ^^
45-
;; xxxxx
46-
;; -------
43+
;;!! a /= 25
44+
;;! ^^
45+
;;! xxxxx
46+
;;! -------
4747
(
4848
(augmented_assignment
4949
[
@@ -64,44 +64,46 @@
6464
) @_.domain
6565
)
6666

67-
;; d = {"a": 1234}
68-
;; ^^^^
69-
;; xxxxxx
70-
;; ---------
67+
;;!! d = {"a": 1234}
68+
;;! ^^^^
69+
;;! xxxxxx
70+
;;! ---------
7171
;;
72-
;; {value: key for (key, value) in d1.items()}
73-
;; ^^^
74-
;; xxxxx
75-
;; ----------
76-
(pair
77-
":" @_.leading
78-
value: (_) @value
79-
) @_.domain
72+
;;!! {value: key for (key, value) in d1.items()}
73+
;;! ^^^
74+
;;! xxxxx
75+
;;! ----------
76+
(
77+
(_
78+
[
79+
":"
80+
":="
81+
] @_.leading
82+
value: (_) @value
83+
) @_.domain
84+
(#not-type? @_.domain subscript parameters)
85+
)
8086

81-
;; def func(value: str=""):
82-
;; ^^
83-
;; xxx
84-
;; -------------
87+
;;!! def func(value: str=""):
88+
;;! ^^
89+
;;! xxx
90+
;;! -------------
8591
(parameters
8692
(_
8793
"=" @_.leading
8894
value: (_) @value
8995
) @_.domain
9096
)
9197

92-
;; def func():
93-
;; return 1
94-
;; ^
95-
;; x
96-
;; --------
98+
;;!! return 1
99+
;;! ^
100+
;;! --------
97101
;;
98102
;; NOTE: in tree-sitter, both "return" and the "1" are children of `return_statement`
99103
;; but "return" is anonymous whereas "1" is named node, so no need to exclude explicitly
100-
(
101-
(return_statement
102-
(_) @value
103-
) @_.domain
104-
)
104+
(return_statement
105+
(_) @value
106+
) @_.domain
105107

106108
(
107109
(function_definition

0 commit comments

Comments
 (0)