dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

C#: cdoes not work #65378

Closed vsfeedback closed 1 week ago

vsfeedback commented 1 year ago

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] I'm working on a number of files that contain many of the same keywords; for example, one file contains a larger number of 'await' and 'async' keywords. Whenever I set the cursor on an instance of a particular keyword, ALL of the other instances of that keyword on the page light up and it's highly distracting.

This action should be managed by the Tools -> Options -> Text Editor -> C# -> Advanced -> Highlighting check boxes:

Highlight references to symbol under cursor
Highlight related keywords under cursor

But setting or clearing the check boxes has no effect. I have attached a screenshot of an example of this problem.


Original Comments

Feedback Bot on 11/7/2022, 11:23 PM:

(private comment, text removed)

Feedback Bot on 11/7/2022, 11:23 PM:

(private comment, text removed)


Original Solutions

(no solutions)

Youssef1313 commented 1 year ago

@arkalyanms This looks like a bug rather than a Feature Request?

My first guess would be that changes to OptionStore aren't reflected in GlobalOptions some how?

As a starting point for investigation, I think we need to first confirm if we properly hit this code path when checking/unchecking the option:

https://github.com/dotnet/roslyn/blob/cc216c93956a2c534d551568b9ae825dc3a5a6c4/src/VisualStudio/Core/Impl/Options/PerLanguageOptionBinding.cs#L44

Then, see what happens in https://github.com/dotnet/roslyn/blob/cc216c93956a2c534d551568b9ae825dc3a5a6c4/src/EditorFeatures/Core/KeywordHighlighting/HighlighterViewTaggerProvider.cs#L88-L91

(assuming my understanding to how things should work is correct)

Youssef1313 commented 1 year ago

This may be the same root cause https://github.com/dotnet/roslyn/issues/64317 (but better to not close as a duplicate until this is confirmed)

Youssef1313 commented 1 year ago

I cannot reproduce the issue. Changing the "Highlight related keywords under cursor" works properly for me.

https://user-images.githubusercontent.com/31348972/202100183-7c910adb-6580-4efa-abf8-3a5df41dc604.mp4

CyrusNajmabadi commented 1 week ago

Closing out as not repro.