We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2c56e0 commit 74a7588Copy full SHA for 74a7588
src/harness/unittests/extractMethods.ts
@@ -378,6 +378,8 @@ namespace A {
378
"Cannot extract range containing conditional return statement."
379
]);
380
381
+ testExtractRangeFailed("extract-method-not-for-token-expression-statement", `[#|a|]`, ["Select more than a single token."]);
382
+
383
testExtractMethod("extractMethod1",
384
`namespace A {
385
let x = 1;
src/services/refactors/extractMethod.ts
@@ -227,7 +227,7 @@ namespace ts.refactor.extractMethod {
227
}
228
229
function checkRootNode(node: Node): Diagnostic[] | undefined {
230
- if (isToken(node)) {
+ if (isToken(isExpressionStatement(node) ? node.expression : node)) {
231
return [createDiagnosticForNode(node, Messages.InsufficientSelection)];
232
233
return undefined;
0 commit comments