MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / findNode

Function findNode

src/telemetryGenerator.node.ts:87–104  ·  view source on GitHub ↗
(sourceFile: ts.SourceFile, position: number, length?: number)

Source from the content-addressed store, hash-verified

85}
86
87function findNode(sourceFile: ts.SourceFile, position: number, length?: number): ts.Node | undefined {
88 let found: ts.Node | undefined;
89 let lastFoundNode: ts.Node | undefined;
90 sourceFile.forEachChild(visit);
91
92 function visit(node: ts.Node) {
93 if (node.pos === position) {
94 found = node;
95 return;
96 } else if (node.pos > position) {
97 return;
98 } else if (length && node.pos < position && node.end >= position + length) {
99 lastFoundNode = node;
100 }
101 ts.forEachChild(node, visit);
102 }
103 return found || lastFoundNode;
104}
105
106type TelemetryProperty = {
107 name: string;

Callers 1

visitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected