MCPcopy Create free account
hub / github.com/nodejs/node / getFixableErrorSpanExpression

Function getFixableErrorSpanExpression

test/fixtures/snapshot/typescript.js:129393–129405  ·  view source on GitHub ↗
(sourceFile, span)

Source from the content-addressed store, hash-verified

129391 ts.getRefactorContextSpan = getRefactorContextSpan;
129392 /* @internal */
129393 function getFixableErrorSpanExpression(sourceFile, span) {
129394 var token = getTokenAtPosition(sourceFile, span.start);
129395 // Checker has already done work to determine that await might be possible, and has attached
129396 // related info to the node, so start by finding the expression that exactly matches up
129397 // with the diagnostic range.
129398 var expression = ts.findAncestor(token, function (node) {
129399 if (node.getStart(sourceFile) < span.start || node.getEnd() > ts.textSpanEnd(span)) {
129400 return "quit";
129401 }
129402 return ts.isExpression(node) && textSpansEqual(span, createTextSpanFromNode(node, sourceFile));
129403 });
129404 return expression;
129405 }
129406 ts.getFixableErrorSpanExpression = getFixableErrorSpanExpression;
129407 function mapOneOrMany(valueOrArray, f, resultSelector) {
129408 if (resultSelector === void 0) { resultSelector = ts.identity; }

Callers

nothing calls this directly

Calls 3

getTokenAtPositionFunction · 0.85
textSpansEqualFunction · 0.85
createTextSpanFromNodeFunction · 0.85

Tested by

no test coverage detected