MCPcopy Index your code
hub / github.com/continuedev/continue / getAst

Function getAst

core/autocomplete/util/ast.ts:8–24  ·  view source on GitHub ↗
(
  filepath: string,
  fileContents: string,
)

Source from the content-addressed store, hash-verified

6export type AstPath = Parser.SyntaxNode[];
7
8export async function getAst(
9 filepath: string,
10 fileContents: string,
11): Promise<Parser.Tree | undefined> {
12 const parser = await getParserForFile(filepath);
13
14 if (!parser) {
15 return undefined;
16 }
17
18 try {
19 const ast = parser.parse(fileContents);
20 return ast;
21 } catch (e) {
22 return undefined;
23 }
24}
25
26export async function getTreePathAtCursor(
27 ast: Parser.Tree,

Callers 15

testRootPathContextFunction · 0.90
extractTopLevelDeclsFunction · 0.90
getHoleContextMethod · 0.90
generateTargetTypesMethod · 0.90
normalizeMethod · 0.90
initMethod · 0.90
staticRerankJumpFunction · 0.90
crawlTypesFunction · 0.90

Calls 1

getParserForFileFunction · 0.90

Tested by

no test coverage detected