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

Have find references navigate to a position instead of a span #75418

Merged
merged 10 commits into from
Oct 10, 2024

Conversation

CyrusNajmabadi
Copy link
Member

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.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner October 7, 2024 20:22
@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 7, 2024
@CyrusNajmabadi
Copy link
Member Author

@genlu @Cosifne ptal :)

@@ -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)

Copy link
Member

@genlu genlu Oct 8, 2024

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?

Copy link
Member

@genlu genlu left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi merged commit 3df983f into dotnet:main Oct 10, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Oct 10, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the navToPosition2 branch October 10, 2024 19:31
@akhera99 akhera99 modified the milestones: Next, 17.13 P1 Oct 28, 2024
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 VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants