File tree Expand file tree Collapse file tree 2 files changed +12
-34
lines changed
packages/cursorless-engine/src/languages/TreeSitterQuery Expand file tree Collapse file tree 2 files changed +12
-34
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,6 @@ class NotType extends QueryPredicateOperator<NotType> {
19
19
}
20
20
}
21
21
22
- /**
23
- * A predicate operator that returns true if the nodes range is not empty.
24
- */
25
- class NotEmpty extends QueryPredicateOperator < NotEmpty > {
26
- name = "not-empty?" as const ;
27
- schema = z . tuple ( [ q . node ] ) ;
28
- run ( { range } : MutableQueryCapture ) {
29
- return ! range . isEmpty ;
30
- }
31
- }
32
-
33
22
/**
34
23
* A predicate operator that returns true if the node's parent is not of the
35
24
* given type. For example, `(not-parent-type? @foo string)` will reject the
@@ -208,7 +197,6 @@ class InsertionDelimiter extends QueryPredicateOperator<InsertionDelimiter> {
208
197
export const queryPredicateOperators = [
209
198
new Log ( ) ,
210
199
new NotType ( ) ,
211
- new NotEmpty ( ) ,
212
200
new NotParentType ( ) ,
213
201
new IsNthChild ( ) ,
214
202
new ChildRange ( ) ,
Original file line number Diff line number Diff line change 25
25
(parrot_declaration)
26
26
] @statement
27
27
28
- (
29
- [
30
- (matches)
31
- (declarations)
32
- (block)
33
- ] @statement.iteration
34
-
35
- ;; The Talon Tree sitter can contain an empty matches node if there is no
36
- ;; header. When this happens and the user has an empty cursor at the start of
37
- ;; the document we get an empty range for the iteration scope for
38
- ;; key/value/name/statement.
39
- (#not-empty? @statement.iteration )
40
- )
28
+ [
29
+ (matches)
30
+ (declarations)
31
+ (block)
32
+ ] @statement.iteration
41
33
42
34
;; !! not mode: command
43
35
;; ! ----^^^^---------
107
99
;; ! -------------
108
100
;; !! foo: key(a)
109
101
;; ! -----------]
110
- (
111
- (source_file
112
- (matches) @condition @_.trailing
113
- ) @_.domain
114
- (#not-empty? @condition )
115
- (#not-empty? @_.trailing )
116
- (#shrink-to-match! @condition "^(?<keep>.*)(\s|\n|\r)+-$")
117
- (#shrink-to-match! @_.trailing "^.*(?<keep>(\s|\n|\r)+-)$")
118
- )
102
+ (source_file
103
+ (matches
104
+ (_) @condition.end.endOf
105
+ .
106
+ "-" @_.trailing
107
+ ) @condition.start.startOf
108
+ ) @_.domain
119
109
120
110
;; !! slap: key(enter)
121
111
;; ! ^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments