Skip to content

Commit 7413918

Browse files
committed
Re-enable extraction of single tokens
Now that we explicitly prevent extraction of empty spans.
1 parent 95594e3 commit 7413918

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/services/refactors/extractMethod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace ts.refactor.extractMethod {
9292
export const CannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators: DiagnosticMessage = createMessage("Cannot extract range containing writes to references located outside of the target range in generators.");
9393
export const TypeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope.");
9494
export const FunctionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope.");
95-
export const InsufficientSelection = createMessage("Select more than a single token.");
95+
export const InsufficientSelection = createMessage("Select more than a single identifier.");
9696
export const CannotExtractExportedEntity = createMessage("Cannot extract exported declaration");
9797
export const CannotCombineWritesAndReturns = createMessage("Cannot combine writes and returns");
9898
export const CannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor");
@@ -231,7 +231,7 @@ namespace ts.refactor.extractMethod {
231231
}
232232

233233
function checkRootNode(node: Node): Diagnostic[] | undefined {
234-
if (isToken(isExpressionStatement(node) ? node.expression : node)) {
234+
if (isIdentifier(isExpressionStatement(node) ? node.expression : node)) {
235235
return [createDiagnosticForNode(node, Messages.InsufficientSelection)];
236236
}
237237
return undefined;

0 commit comments

Comments
 (0)