Change QueryResult to be QueryCapture and QueryMatch

matches/captures return 2 different types of object so this change corrects the return types
This commit is contained in:
Stafford Brunk 2020-11-03 08:20:20 -07:00
parent a7a6139e70
commit 2f897b4d73
No known key found for this signature in database
GPG key ID: FA8D5C2ED2587ADC

View file

@ -137,9 +137,14 @@ declare module 'web-tree-sitter' {
query(source: string): Query;
}
interface QueryResult {
interface QueryCapture {
name: string;
node: SyntaxNode;
}
interface QueryMatch {
pattern: number;
captures: { name: string; node: SyntaxNode }[];
captures: QueryCapture[];
}
interface PredicateResult {
@ -151,8 +156,8 @@ declare module 'web-tree-sitter' {
captureNames: string[];
delete(): void;
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryResult[];
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryResult[];
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryMatch[];
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point): QueryCapture[];
predicatesForPattern(patternIndex: number): PredicateResult[];
}
}