Skip to content
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

Navigate to the mapped span when navigating to a mapped file #75460

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Oct 9, 2024

Fixes AB#2136046

Roslyn was helpfully mapping to a file, but then trying to navigate to the unmapped span. This fixes that, and allows the mapped file to be an AdditionalDocument rather than just a Document.

I couldn't find any tests that specifically covered this, but let me know if I missed them somewhere.

@davidwengier davidwengier requested a review from a team as a code owner October 9, 2024 23:11
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 9, 2024
Comment on lines 230 to 231
var getMappedVsTextSpan = (SourceText sourceText) => getVsTextSpanForMapping(sourceText, mappedSpan.Span);
return GetNavigationCallback(documentIdToNavigate, workspace, getMappedVsTextSpan);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var getMappedVsTextSpan = (SourceText sourceText) => getVsTextSpanForMapping(sourceText, mappedSpan.Span);
return GetNavigationCallback(documentIdToNavigate, workspace, getMappedVsTextSpan);
return GetNavigationCallback(
documentIdToNavigate,
workspace,
sourceText => getVsTextSpanForMapping(sourceText, mappedSpan.Span));

@CyrusNajmabadi
Copy link
Member

Going to trust that thsi works :D

@davidwengier davidwengier merged commit c9dd07d into dotnet:main Oct 10, 2024
25 checks passed
@davidwengier davidwengier deleted the NavigateToMappedSpan branch October 10, 2024 23:14
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 10, 2024
@akhera99 akhera99 modified the milestones: Next, 17.13 P1 Oct 28, 2024
davidwengier added a commit that referenced this pull request Nov 14, 2024
Follow up to #75460
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2288477

When I looked at the code I thought "Who would want to map a span, and
then not use the mapped span?!". Turns out the answer is "aspx files".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants