Update TS definitions to support the Query API

This commit is contained in:
Stafford Brunk 2020-10-30 06:57:04 -06:00
parent 9e65d18ec6
commit 505695040d
No known key found for this signature in database
GPG key ID: FA8D5C2ED2587ADC

View file

@ -37,7 +37,7 @@ declare module 'web-tree-sitter' {
export type Logger = (
message: string,
params: {[param: string]: string},
params: { [param: string]: string },
type: "parse" | "lex"
) => void;
@ -131,8 +131,15 @@ declare module 'web-tree-sitter' {
readonly version: number;
readonly fieldCount: number;
fieldNameForId(fieldId: number): string | null
fieldIdForName(fieldName: string): number | null
fieldNameForId(fieldId: number): string | null;
fieldIdForName(fieldName: string): number | null;
query(source: string): Query;
}
class Query {
delete(): void;
matches(node: SyntaxNode, startPosition?: Point, endPosition?: Point);
captures(node: SyntaxNode, startPosition?: Point, endPosition?: Point);
}
}