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 @@ -410,6 +410,8 @@ function test(x: number) {
410410 "Statement or expression expected."
411411 ] ) ;
412412
413+ testExtractRangeFailed ( "extract-method-not-for-token-expression-statement" , `[#|a|]` , [ "Select more than a single token." ] ) ;
414+
413415 testExtractMethod ( "extractMethod1" ,
414416 `namespace A {
415417 let x = 1;
Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ namespace ts.refactor.extractMethod {
231231 }
232232
233233 function checkRootNode ( node : Node ) : Diagnostic [ ] | undefined {
234- if ( isToken ( node ) ) {
234+ if ( isToken ( isExpressionStatement ( node ) ? node . expression : node ) ) {
235235 return [ createDiagnosticForNode ( node , Messages . InsufficientSelection ) ] ;
236236 }
237237 return undefined ;
You can’t perform that action at this time.
0 commit comments