Exclude top-level imports from document symbols - #64160
Open
Jake Bailey (jakebailey) with Copilot wants to merge 4 commits into
Open
Jake Bailey (jakebailey) with Copilot wants to merge 4 commits into
Jake Bailey (jakebailey) with Copilot wants to merge 4 commits into
Conversation
1 task
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
| @@ -1,23 +1,4 @@ | |||
| // === Document Symbols === | |||
| // === /navigationBarItemsImports.ts === | |||
There was a problem hiding this comment.
Hm, I forgot that the outline also powers the navigation bar. Maybe nobody's navigating within an import?
Copilot
AI
changed the title
[WIP] Fix TypeScript LSP documentSymbol response for top-level imports
Exclude top-level imports from document symbols
Sep 3, 2026
Jake Bailey (jakebailey)
marked this pull request as ready for review
September 21, 2026 19:07
Copilot started reviewing on behalf of
Jake Bailey (jakebailey)
September 21, 2026 19:08
View session
Member
|
Marking as ready for review, but we need to make sure this doesn't regress VS. Joaquin Jares (@joj) navya9singh for awareness. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The early return unintentionally suppresses JSDoc typedef and callback symbols attached to imports.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Excludes top-level imports from native LSP document symbols while retaining regular declarations.
Changes:
- Filters import and import-equals declarations.
- Adds and updates fourslash coverage and baselines.
| File | Description |
|---|---|
tsc/internal/ls/symbols.go |
Filters top-level imports. |
tsc/internal/fourslash/tests/documentSymbolTopLevelImports_test.go |
Adds regression coverage. |
tsc/testdata/baselines/reference/fourslash/documentSymbols/documentSymbolTopLevelImports.baseline |
Records mixed import/declaration output. |
tsc/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsImports.baseline |
Removes imported symbols. |
tsc/testdata/baselines/reference/fourslash/documentSymbols/navigationBarItemsExports.baseline |
Removes exported import-equals symbol. |
tsc/testdata/baselines/reference/fourslash/documentSymbols/navigationBarImports.baseline |
Removes imported symbols. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| if ctx.Err() != nil { | ||
| return true | ||
| } | ||
| if node.Parent.Kind == ast.KindSourceFile && ast.IsImportOrImportEqualsDeclaration(node) { |
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
This branch has not been deployed
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.


The native LSP reported top-level imports through
textDocument/documentSymbol, unlike the established VS Code Outline behavior.The response includes
local, but notvalue.textDocument/documentSymbolresponse? #64155