Skip to content

Fix getAdjustedLocationForDeclaration oops - #65472

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/default-declaration-location
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:compiler-fixes/default-declaration-location

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Not sure how this happened; we somehow didn't actually use the param here!

Reference searches on export and async tokens must resolve to the default
symbol of an unnamed class or function. The modifier predicate inspected
the enclosing declaration instead of its argument, so it never matched.

Inspect each modifier and cover declaration keywords and imported usages
in the existing anonymous default-export reference tests.
Copilot AI balanced review requested due to automatic review settings November 13, 2026 04:46
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 13, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 13, 2026

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 active review issues remain for the fix to reference locations of anonymous default-exported classes and functions.

No open issues 🎉

What changed in this PR

Fixes getAdjustedLocationForDeclaration in the language server so anonymous default-exported classes and functions resolve to their default modifier.

Changes:

  • Checks the modifier callback parameter instead of the enclosing declaration.
  • Adds Find All References regression tests and baselines covering declaration keywords, imports, and usages.
File Description
tsc/​testdata/​baselines/​reference/​fourslash/​findAllReferences/​findAllRefsForDefaultExport_anonymousFunction.baseline.jsonc Records expected references for an anonymous default-exported async function.
tsc/​testdata/​baselines/​reference/​fourslash/​findAllReferences/​findAllRefsForDefaultExport_anonymousClass.baseline.jsonc Records expected references for an anonymous default-exported class.
tsc/​internal/​ls/​utilities.go Corrects the predicate that finds the default modifier.
tsc/​internal/​fourslash/​tests/​findAllRefsForDefaultExport_anonymous_test.go Adds reference tests for anonymous default-exported classes and functions.

Review effort: Balanced

This branch has not been deployed

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

Labels

Author: Team 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.

2 participants