MCPcopy Index your code
hub / github.com/nodejs/node / getRefactorEditsToExtractSymbol

Function getRefactorEditsToExtractSymbol

test/fixtures/snapshot/typescript.js:160105–160121  ·  view source on GitHub ↗
(context, actionName)

Source from the content-addressed store, hash-verified

160103 extractSymbol.getRefactorActionsToExtractSymbol = getRefactorActionsToExtractSymbol;
160104 /* Exported for tests */
160105 function getRefactorEditsToExtractSymbol(context, actionName) {
160106 var rangeToExtract = getRangeToExtract(context.file, ts.getRefactorContextSpan(context));
160107 var targetRange = rangeToExtract.targetRange; // TODO:GH#18217
160108 var parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName);
160109 if (parsedFunctionIndexMatch) {
160110 var index = +parsedFunctionIndexMatch[1];
160111 ts.Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index");
160112 return getFunctionExtractionAtIndex(targetRange, context, index);
160113 }
160114 var parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName);
160115 if (parsedConstantIndexMatch) {
160116 var index = +parsedConstantIndexMatch[1];
160117 ts.Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index");
160118 return getConstantExtractionAtIndex(targetRange, context, index);
160119 }
160120 ts.Debug.fail("Unrecognized action name");
160121 }
160122 extractSymbol.getRefactorEditsToExtractSymbol = getRefactorEditsToExtractSymbol;
160123 // Move these into diagnostic messages if they become user-facing
160124 var Messages;

Callers

nothing calls this directly

Calls 6

getRangeToExtractFunction · 0.85
assertMethod · 0.80
execMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…