Skip to content

Conversation

@jakebailey
Copy link
Member

Fixes #2204

  • getReferencesAtExportSpecifier had not been ported.
  • getReferencedSymbolsForSymbol had a condition backwards.

Finding the latter involved debugging a panic; in this PR is also a fix to fourslash to actually print out an error message instead of "nil response".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #2204 by implementing the missing getReferencesAtExportSpecifier function and correcting a boolean logic error in getReferencedSymbolsForSymbol. The changes enable proper handling of references in export specifiers, particularly for re-exports and aliased exports.

Key Changes

  • Implemented getReferencesAtExportSpecifier function that was previously marked as "not implemented"
  • Fixed backwards condition in getReferencedSymbolsForSymbol (changed !isForRenameWithPrefixAndSuffixText to isForRenameWithPrefixAndSuffixText)
  • Enhanced fourslash test error reporting to display actual error messages instead of "nil response"

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/ls/findallreferences.go Core implementation: added getReferencesAtExportSpecifier function, fixed boolean condition, added seenReExportRHS field to track seen re-export right-hand sides, and enabled calls to the new function
internal/fourslash/fourslash.go Improved error handling to report actual LSP errors instead of generic "nil response" messages
internal/fourslash/tests/statefindallrefs_test.go Added comprehensive test for re-exports in multi-project solutions to verify the fix
internal/fourslash/tests/gen/renameForAliasingExport02_test.go Removed t.Skip() to enable previously failing test
internal/fourslash/_scripts/failingTests.txt Removed TestRenameForAliasingExport02 from failing tests list
testdata/baselines/reference/submodule/fourslash/findRenameLocations/.baseline.jsonc Updated baselines showing convergence with TypeScript behavior - export specifiers now correctly show rename locations
testdata/baselines/reference/fourslash/findAllReferences/*.baseline.jsonc Updated baselines showing export specifiers are now correctly identified as references
testdata/baselines/reference/fourslash/documentHighlights/*.baseline.jsonc Updated baselines showing export specifiers are now correctly highlighted
testdata/baselines/reference/fourslash/state/*.baseline Updated state baselines reflecting correct reference tracking for export specifiers


var exportSpecifier *ast.Node
if !isForRenameWithPrefixAndSuffixText(options) || len(symbol.Declarations) == 0 {
if isForRenameWithPrefixAndSuffixText(options) && len(symbol.Declarations) != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Not specific to this PR, but maybe we want to rename this function since the actual user preference is useAliasesForRenames?

Copy link
Member Author

Choose a reason for hiding this comment

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

It was called isForRenameWithPrefixAndSuffixText in Strada, we are just seemingly inconsistent all around...

Copy link
Member

Choose a reason for hiding this comment

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

I know, that's what I meant. Strada used providePrefixAndSuffixTextForRename as the preference name and related functions, but it was called useAliasesForRenames in vscode, and now in Corsa we confusingly have both terms.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Probably better fixed in another PR. #2272 at least lets us choose whichever name we want.

Copy link
Member

@gabritto gabritto left a comment

Choose a reason for hiding this comment

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

This looks good, thanks! I think the remaining rename diffs may just be because we haven't set up rename user preferences yet I think.

@jakebailey jakebailey added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main with commit 41e1964 Dec 9, 2025
28 checks passed
@jakebailey jakebailey deleted the jabaile/fix-2204 branch December 9, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] TSGO fails to follow re-exports when finding references

3 participants