-
Notifications
You must be signed in to change notification settings - Fork 784
fix(2426): goToDefinition for pattern ambient module no longer goes to implementation #2429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
a-tarasyuk
wants to merge
5
commits into
microsoft:main
Choose a base branch
from
a-tarasyuk:fix/2426
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
69c1134
fix(2426): extend go to def locations with reference target
a-tarasyuk c950912
add chompLeadingSpace to align with Strada behavior
a-tarasyuk 27636da
Merge branch 'main' of https://github.com/microsoft/typescript-go int…
a-tarasyuk 258bf90
cleanup
a-tarasyuk 811f13f
Merge branch 'main' into fix/2426
a-tarasyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To minimize some of the diffs, can you do something like this?
(not sure if
filemight benilthough)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanielRosenwasser thanks for the feedback. The file can be
nil., even if it exists, this case is handled using a range with zero positionshttps://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/src/services/goToDefinition.ts#L123-L127
https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/src/services/goToDefinition.ts#L764-L774
if the file is used for the range, the selection will look like this
Several differences in this PR are due to handling whitespace at the start of the file, for example
https://github.com/microsoft/typescript-go/pull/2429/files#diff-f36f4a55771065e64894e0d32a5c744439364e2a7804d6267af778e0d4ac09ddR3
https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/tests/cases/fourslash/goToDefinitionExternalModuleName.ts#L8
https://github.com/microsoft/TypeScript/blob/main/tests/baselines/reference/goToDefinitionExternalModuleName.baseline.jsonc#L3
Before
After
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case,
createLspRangeFromNodeorcreateLspRangeFromRangeshould take care of those differences.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These diffs are related to missing chompLeadingSpace from the test parser. I’m not sure whether this behavior should be preserved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of failing formatting tests, but they’re all in
genfolder, which shouldn’t be modified directly. We probably need to regenerate the tests for these cases. For example, Strada behaviour for some of them,this test has 4 spaces after
///https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/tests/cases/fourslash/semicolonFormattingInsideAStringLiteral.ts#L3
but the behavior is validated with 3 spaces
https://github.com/microsoft/TypeScript/blob/f3770c9b89ba7969b163c5cea7805d5df23b2086/tests/cases/fourslash/semicolonFormattingInsideAStringLiteral.ts#L9
Anyway, the remaining question is whether we should proceed with or without the
chompLeadingSpacehelper.