fix(47820): forbid extraction jsdoc

This commit is contained in:
Oleksandr T
2022-02-10 11:35:06 +02:00
parent df673f74f5
commit 8f0e9356c3
2 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -283,7 +283,7 @@ namespace ts.refactor.extractSymbol {
// Walk up starting from the the start position until we find a non-SourceFile node that subsumes the selected span.
// This may fail (e.g. you select two statements in the root of a source file)
const start = cursorRequest ? getExtractableParent(startToken): getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
const start = cursorRequest ? getExtractableParent(startToken) : getParentNodeInSpan(startToken, sourceFile, adjustedSpan);
// Do the same for the ending position
const end = cursorRequest ? start : getParentNodeInSpan(endToken, sourceFile, adjustedSpan);
@@ -299,7 +299,7 @@ namespace ts.refactor.extractSymbol {
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] };
}
if (isJSDoc(start)) {
if (start.flags & NodeFlags.JSDoc) {
return { errors: [createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractJSDoc)] };
}
+9
View File
@@ -0,0 +1,9 @@
/// <reference path='fourslash.ts' />
/////**
//// * /*a*//*b*/
//// * {@link Foo}
//// */
goTo.select("a", "b");
verify.not.refactorAvailableForTriggerReason("invoked", "Extract Symbol");