Skip to content

Commit a6d9858

Browse files
authored
fix(54068): Organize Imports removes first deprecated JSDoc comment (#54071)
1 parent 3cfd6d2 commit a6d9858

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/services/organizeImports.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import {
6060
SortKind,
6161
SourceFile,
6262
stableSort,
63-
suppressLeadingTrivia,
6463
SyntaxKind,
6564
textChanges,
6665
TransformFlags,
@@ -137,7 +136,7 @@ export function organizeImports(
137136
// on the first import because it is probably the header comment for the file.
138137
// Consider: we could do a more careful check that this trivia is actually a header,
139138
// but the consequences of being wrong are very minor.
140-
suppressLeadingTrivia(oldImportDecls[0]);
139+
setEmitFlags(oldImportDecls[0], EmitFlags.NoLeadingComments);
141140

142141
const oldImportGroups = shouldCombine
143142
? group(oldImportDecls, importDecl => getExternalModuleName(importDecl.moduleSpecifier)!)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @filename: /a.ts
4+
////export interface LocationDefinitions {}
5+
////export interface PersonDefinitions {}
6+
7+
// @filename: /b.ts
8+
////export {
9+
//// /** @deprecated Use LocationDefinitions instead */
10+
//// LocationDefinitions as AddressDefinitions,
11+
//// LocationDefinitions,
12+
//// /** @deprecated Use PersonDefinitions instead */
13+
//// PersonDefinitions as NameDefinitions,
14+
//// PersonDefinitions,
15+
////} from './a';
16+
17+
goTo.file("/b.ts");
18+
verify.organizeImports(
19+
`export {
20+
/** @deprecated Use LocationDefinitions instead */
21+
LocationDefinitions as AddressDefinitions,
22+
LocationDefinitions,
23+
/** @deprecated Use PersonDefinitions instead */
24+
PersonDefinitions as NameDefinitions,
25+
PersonDefinitions
26+
} from './a';
27+
`);

0 commit comments

Comments
 (0)