Merge pull request #18563 from amcasey/GH18546

Stop requiring that the full range of a declaration fall within the selection
This commit is contained in:
Andrew Casey authored and GitHub committed 2017-09-19 10:47:16 -07:00
commit cb63ea5242
4 files changed
+27 -6

No files matched your search

+5
View File
@@ -768,6 +768,11 @@ function parsePrimaryExpression(): any {
}
}|]
}
}`);
// Selection excludes leading trivia of declaration
testExtractMethod("extractMethod33",
`function F() {
[#|function G() { }|]
}`);
});
+1 -1
View File
@@ -1205,7 +1205,7 @@ namespace ts.refactor.extractMethod {
if (!declInFile) {
return undefined;
}
if (rangeContainsRange(enclosingTextRange, declInFile)) {
if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) {
// declaration is located in range to be extracted - do nothing
return undefined;
}