File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/cursorless-engine/src/languages/TreeSitterQuery Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,19 @@ class AllowMultiple extends QueryPredicateOperator<AllowMultiple> {
161
161
}
162
162
}
163
163
164
+ /**
165
+ * A predicate operator that logs a node, for debugging.
166
+ */
167
+ class Log extends QueryPredicateOperator < Log > {
168
+ name = "log!" as const ;
169
+ schema = z . tuple ( [ q . node ] ) ;
170
+
171
+ run ( nodeInfo : MutableQueryCapture ) {
172
+ console . log ( `#log!: ${ nodeInfo . name } @${ nodeInfo . range } ` ) ;
173
+ return true ;
174
+ }
175
+ }
176
+
164
177
/**
165
178
* A predicate operator that sets the insertion delimiter of the match. For
166
179
* example, `(#insertion-delimiter! @foo ", ")` will set the insertion delimiter
@@ -178,6 +191,7 @@ class InsertionDelimiter extends QueryPredicateOperator<InsertionDelimiter> {
178
191
}
179
192
180
193
export const queryPredicateOperators = [
194
+ new Log ( ) ,
181
195
new NotType ( ) ,
182
196
new NotEmpty ( ) ,
183
197
new NotParentType ( ) ,
You can’t perform that action at this time.
0 commit comments