diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts
index 9a85c7acd54..103b156c9c4 100644
--- a/src/services/organizeImports.ts
+++ b/src/services/organizeImports.ts
@@ -145,6 +145,7 @@ export function organizeImports(
// Consider the first node to have trailingTrivia as we want to exclude the
// "header" comment.
changeTracker.deleteNodes(sourceFile, oldImportDecls, {
+ leadingTriviaOption: textChanges.LeadingTriviaOption.Exclude,
trailingTriviaOption: textChanges.TrailingTriviaOption.Include,
}, /*hasTrailingComment*/ true);
}
diff --git a/tests/cases/fourslash/organizeImports14.ts b/tests/cases/fourslash/organizeImports14.ts
new file mode 100644
index 00000000000..cd19c162100
--- /dev/null
+++ b/tests/cases/fourslash/organizeImports14.ts
@@ -0,0 +1,33 @@
+///
+
+// @filename: /a.ts
+////export const foo = 1;
+
+// @filename: /b.ts
+/////**
+//// * Module doc comment
+//// *
+//// * @module
+//// */
+////
+////// comment 1
+////
+////// comment 2
+////
+////import { foo } from "./a";
+////import { foo } from "./a";
+////import { foo } from "./a";
+
+goTo.file("/b.ts");
+verify.organizeImports(
+`/**
+ * Module doc comment
+ *
+ * @module
+ */
+
+// comment 1
+
+// comment 2
+
+`);
diff --git a/tests/cases/fourslash/organizeImports15.ts b/tests/cases/fourslash/organizeImports15.ts
new file mode 100644
index 00000000000..afdb1bbcba1
--- /dev/null
+++ b/tests/cases/fourslash/organizeImports15.ts
@@ -0,0 +1,31 @@
+///
+
+// @filename: /a.ts
+////export const foo = 1;
+
+// @filename: /b.ts
+/////**
+//// * Module doc comment
+//// *
+//// * @module
+//// */
+////
+////// comment 1
+////
+////// comment 2
+////
+////import { foo } from "./a";
+
+goTo.file("/b.ts");
+verify.organizeImports(
+`/**
+ * Module doc comment
+ *
+ * @module
+ */
+
+// comment 1
+
+// comment 2
+
+`);