Fix import statement completion filtering in tsgo - #64357
Merged
Jake Bailey (jakebailey) merged 1 commit intoSep 21, 2026
Merged
Jake Bailey (jakebailey) merged 1 commit into
Jake Bailey (jakebailey) merged 1 commit into
Conversation
Copilot started reviewing on behalf of
雪代 / Yukishiro (yksr-melt)
September 20, 2026 05:25
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches the completion edit range and is covered by targeted regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes tsgo auto-import completions being filtered out inside named imports.
Changes:
- Uses the generated import statement as completion
filterText. - Adds fourslash coverage for bare braces and partial names.
| File | Description |
|---|---|
tsc/internal/ls/completions.go |
Corrects import completion filtering. |
tsc/internal/fourslash/tests/importStatementCompletions_braces_test.go |
Adds regression tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
@microsoft-github-policy-service agree |
Jake Bailey (jakebailey)
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #64270
With tsgo (TypeScript 7), VS Code does not show auto-import completions inside named imports such as
import {andimport { fo.Import statement completions replace the whole statement typed so far, so the edit range of each item starts at
import. VS Code matches the text from the start of that range to the cursor against the item'sfilterText.filterTextwas only the export name (foo), so every candidate was filtered out on the client.This sets the
filterTextof import statement completions to the generated statement (insertText, e.g.import { foo$1 } from "./mod";). Other completions are not affected.#64270 was reported against 7.0.2, which predates microsoft/typescript-go#3949 and returns no import statement candidates at all. This change addresses the remaining client-side filtering for builds that include it.
Testing
Added
tsc/internal/fourslash/tests/importStatementCompletions_braces_test.go, which coversimport {andimport { fo. It checksFilterTexttogether withInsertText, the text edit range and the auto-import data. Both tests fail without the change; the existing import statement completion tests did not assertFilterText.Local verification:
npx hereby check:format: passed.go test ./...intsc(whatnpx hereby testruns): all packages passed..golangci.ymlon thetscmodule (whatnpx hereby lintruns first): 0 issues. Thetoolsmodule could not be linted on my machine because some of its dependencies are not available offline; this change does not touch it.AI assistance
I used Claude Code to help investigate the issue, write the change and the tests, and draft this description. I chose this issue, have reviewed the change, and will follow up on review feedback.