Repository navigation
Fix getAdjustedLocationForDeclaration oops - #65472
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
🟢 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
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.
Not sure how this happened; we somehow didn't actually use the param here!