mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
extractMethod: Don't try to extract a single token (#18090)
* extractMethod: Don't try to extract a single token * Update tests
This commit is contained in:
1 parent
b3c87aa919
commit
b533b24686
5 files changed
+17
-10
No files matched your search
@@ -95,7 +95,7 @@ namespace ts.refactor.extractMethod {
|
||||
export const CannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators: DiagnosticMessage = createMessage("Cannot extract range containing writes to references located outside of the target range in generators.");
|
||||
export const TypeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope.");
|
||||
export const FunctionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope.");
|
||||
export const InsufficientSelection = createMessage("Select more than a single identifier.");
|
||||
export const InsufficientSelection = createMessage("Select more than a single token.");
|
||||
export const CannotExtractExportedEntity = createMessage("Cannot extract exported declaration");
|
||||
export const CannotCombineWritesAndReturns = createMessage("Cannot combine writes and returns");
|
||||
export const CannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor");
|
||||
@@ -239,7 +239,7 @@ namespace ts.refactor.extractMethod {
|
||||
}
|
||||
|
||||
function checkRootNode(node: Node): Diagnostic[] | undefined {
|
||||
if (isIdentifier(node)) {
|
||||
if (isToken(node)) {
|
||||
return [createDiagnosticForNode(node, Messages.InsufficientSelection)];
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in new issue
Block a user