method_definition
This commit is contained in:
parent
faffaf08c4
commit
196992c6bd
4 changed files with 19 additions and 2 deletions
|
|
@ -21,7 +21,11 @@ export class HierarchicalContextService {
|
|||
return `${node.startIndex}`;
|
||||
}
|
||||
|
||||
private static TYPES_TO_USE = new Set(["program", "function_declaration"]);
|
||||
private static TYPES_TO_USE = new Set([
|
||||
"program",
|
||||
"function_declaration",
|
||||
"method_definition",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Key comes from hash of parent key and node type and node id.
|
||||
|
|
@ -54,6 +58,9 @@ export class HierarchicalContextService {
|
|||
TSQueryType.FunctionDeclaration,
|
||||
);
|
||||
break;
|
||||
case "method_definition":
|
||||
query = await getQueryForFile(filepath, TSQueryType.MethodDefinition);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ export enum TSQueryType {
|
|||
Imports = "import-queries",
|
||||
// Used in HierarchicalContextService.ts
|
||||
FunctionDeclaration = "hierarchical-context-queries/function_declaration",
|
||||
MethodDefinition = "hierarchical-context-queries/method_definition",
|
||||
}
|
||||
|
||||
export async function getQueryForFile(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
(function_declaration
|
||||
(formal_parameters
|
||||
(_
|
||||
(type_annotation) @a
|
||||
(type_annotation) @type
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
(
|
||||
(method_definition
|
||||
(formal_parameters
|
||||
(_
|
||||
(type_annotation) @type
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue