File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,8 @@ namespace A {
378
378
"Cannot extract range containing conditional return statement."
379
379
] ) ;
380
380
381
+ testExtractRangeFailed ( "extract-method-not-for-token-expression-statement" , `[#|a|]` , [ "Select more than a single token." ] ) ;
382
+
381
383
testExtractMethod ( "extractMethod1" ,
382
384
`namespace A {
383
385
let x = 1;
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ namespace ts.refactor.extractMethod {
227
227
}
228
228
229
229
function checkRootNode ( node : Node ) : Diagnostic [ ] | undefined {
230
- if ( isToken ( node ) ) {
230
+ if ( isToken ( isExpressionStatement ( node ) ? node . expression : node ) ) {
231
231
return [ createDiagnosticForNode ( node , Messages . InsufficientSelection ) ] ;
232
232
}
233
233
return undefined ;
You can’t perform that action at this time.
0 commit comments