(context, actionName)
| 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; |
nothing calls this directly
no test coverage detected
searching dependent graphs…