-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Have find references navigate to a position instead of a span #75418
Merged
Conversation
This file contains 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
dotnet-issue-labeler
bot
added
Area-IDE
untriaged
Issues and PRs which have not yet been triaged by a lead
labels
Oct 7, 2024
genlu
reviewed
Oct 8, 2024
@@ -101,7 +101,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.GoToDefinition | |||
Dim definitionDocument = workspace.GetTestDocument(mockDocumentNavigationService._documentId) | |||
Assert.Single(definitionDocument.SelectedSpans) | |||
Dim expected = definitionDocument.SelectedSpans.Single() | |||
Assert.True(expected.Length = 0) | |||
Assert.Equal(expected.Start, mockDocumentNavigationService._position) | |||
|
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.
I think the removed assert is still valid?
genlu
approved these changes
Oct 8, 2024
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.
Cosifne
approved these changes
Oct 8, 2024
Open
3 tasks
This was referenced Oct 22, 2024
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.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2261986
Thsi behavior changed back when we added 'navigate to symbol in generated document'. The code there switched us from having the editor navigate (where it would navigate to a position) to roslyn taking over. The code just called our own 'navigate to span' which goes to that span and then selects it. This ended up regressing the scenario for screen readers (which then only read out hte selected word, not the whole line.
It also isn't great for the mainline FAR case when you're editing as well. Because FAR is not life, the 'spans' may grow stale over time. While it would be nice to address that, it's just a fact of how things work. As such, if you make an edit and then navigate to another entry, you can end up with a completely random selection of text. By navigating to a position instead, we at least put you (hopefully) near the original reference, without a bogus selection of text and spaces that you then have to contend with.