File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
packages/cursorless-engine/src/languages/TreeSitterQuery Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { Range } from "@cursorless/common" ;
2
- import { SyntaxNode } from "web-tree-sitter" ;
2
+ import { Point } from "web-tree-sitter" ;
3
+
4
+ /**
5
+ * Simple representation of the tree sitter syntax node. Used by
6
+ * {@link MutableQueryCapture} to avoid using range/text and other mutable
7
+ * parameters directly from the node.
8
+ */
9
+ export interface SimpleSyntaxNode {
10
+ readonly id : number ;
11
+ readonly type : string ;
12
+ readonly startPosition : Point ;
13
+ readonly endPosition : Point ;
14
+ readonly parent : SimpleSyntaxNode | null ;
15
+ readonly children : Array < SimpleSyntaxNode > ;
16
+ }
3
17
4
18
/**
5
19
* A capture of a query pattern against a syntax tree. Often corresponds to a
@@ -39,11 +53,9 @@ export interface QueryMatch {
39
53
*/
40
54
export interface MutableQueryCapture extends QueryCapture {
41
55
/**
42
- * The tree-sitter node that was captured. Note that the range may have already
43
- * been altered by a prior operator, so please use {@link range} instead of
44
- * trying to retrieve the range from the node.
56
+ * The tree-sitter node that was captured.
45
57
*/
46
- readonly node : SyntaxNode ;
58
+ readonly node : Omit < SimpleSyntaxNode , "startPosition" | "endPosition" > ;
47
59
48
60
range : Range ;
49
61
allowMultiple : boolean ;
You can’t perform that action at this time.
0 commit comments