Skip to content

Fix import type code fix comment duplication - #64289

Open
Noamaan Mulla (noamaanMulla-03) wants to merge 1 commit into
microsoft:mainfrom
noamaanMulla-03:fix/import-type-comment-duplication
Open

Noamaan Mulla (noamaanMulla-03) wants to merge 1 commit into
microsoft:mainfrom
noamaanMulla-03:fix/import-type-comment-duplication

Conversation

@noamaanMulla-03

Copy link
Copy Markdown
Contributor

Fixes #64272

Description

Fixes a regression where the Use 'import type' quick fix duplicated comments surrounding a sole named import declaration.

The quick fix now inserts type immediately after the existing import keyword instead of rebuilding and reprinting the declaration. This preserves leading, inline, and trailing comments exactly once.

Tests

  • Added a regression test covering comments before, alongside, and after the import declaration.
  • go test ./tsc/internal/ls/... -count=1
  • go test ./tsc/internal/fourslash/tests -run '^TestCodeFixConvertToTypeOnlyImportPreservesComments$' -count=1

Copilot AI balanced review requested due to automatic review settings September 15, 2026 21:56
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 15, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 15, 2026
@noamaanMulla-03

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues were identified.

Pull request overview

Fixes a regression where the import type quick fix duplicated comments.

Changes:

  • Registers the code-fix provider.
  • Inserts type directly after import.
  • Adds comment-preservation regression coverage.
File summaries
File Description
tsc/internal/ls/codeactions.go Registers the provider.
tsc/internal/ls/codeactions_converttotypeonlyimport.go Implements the text-based fix.
tsc/internal/fourslash/tests/codeFixConvertToTypeOnlyImportComments_test.go Tests comment preservation.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

ts1484 Quick fix will dupe comments

2 participants