mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 23:08:20 -06:00
Component commits: 8f0e9356c3 fix(47820): forbid extraction jsdoc Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
This commit is contained in:
parent
b6ec37aac2
commit
ea5a43a290
@ -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
tests/cases/fourslash/extract-jsdoc.ts
Normal file
9
tests/cases/fourslash/extract-jsdoc.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////**
|
||||
//// * /*a*//*b*/
|
||||
//// * {@link Foo}
|
||||
//// */
|
||||
|
||||
goTo.select("a", "b");
|
||||
verify.not.refactorAvailableForTriggerReason("invoked", "Extract Symbol");
|
||||
Loading…
x
Reference in New Issue
Block a user