Skip to content

Don't try to highlight operators#52041

Merged
davidwengier merged 5 commits intodotnet:mainfrom
davidwengier:DontHighlightOperators
Mar 25, 2021
Merged

Don't try to highlight operators#52041
davidwengier merged 5 commits intodotnet:mainfrom
davidwengier:DontHighlightOperators

Conversation

@davidwengier
Copy link
Member

Fixes #51841

By filtering out operators the symbol finder returns the symbol to the left of the caret and everything else works as normal.

@davidwengier davidwengier requested a review from a team as a code owner March 22, 2021 04:20
Copy link
Contributor

@sharwell sharwell left a comment

Choose a reason for hiding this comment

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

I prefer the approach from #51841 (comment). Highlight references normally has right-affinity from the caret position. All we need to do is change it to have left-affinity from the caret position if the caret is located at the end of a non-empty selection.

This design has two benefits over the current approach from this pull request:

  1. Highlight references will be able to work for operators
  2. It establishes a general precedent for being able to explicitly clarify affinity for an operation by selection

@CyrusNajmabadi
Copy link
Contributor

Yes. i agree with Sam on this. :)

@davidwengier
Copy link
Member Author

I have unlocked the secret knowledge that operator highlighting only works with user defined operators, and thus I am able to understand the comments in this PR. Will update.

@davidwengier
Copy link
Member Author

Just realised a potential issue here: This change means there is a difference between local roslyn behaviour of document highlighting, and LSP behaviour. @dibarbet do you think thats an issue?

@dibarbet
Copy link
Member

Just realised a potential issue here: This change means there is a difference between local roslyn behaviour of document highlighting, and LSP behaviour. @dibarbet do you think thats an issue?

talked offline - the difference is that here we'll send the start of the selection instead of the caret position as the location. So if the platform sent us both the selection and caret then we could make this work in LSP. @davidwengier to file tracking item for that.

@davidwengier davidwengier dismissed sharwell’s stale review March 24, 2021 03:54

Changes have been made

@davidwengier davidwengier merged commit 66926b5 into dotnet:main Mar 25, 2021
@davidwengier davidwengier deleted the DontHighlightOperators branch March 25, 2021 00:20
@ghost ghost added this to the Next milestone Mar 25, 2021
@333fred 333fred mentioned this pull request Mar 25, 2021
333fred added a commit to 333fred/roslyn that referenced this pull request Mar 25, 2021
* upstream/main: (75 commits)
  Split BoundInterpolatedString into BoundInterpolatedString and BoundUnconvertedInterpolatedString (dotnet#52061)
  Combine VB comparers into one, and combine VB and C# comparers together (dotnet#51834)
  Use OptimizedVSCompletionList in LSP scenarios.
  F5 Hot Reload (dotnet#52101)
  Fix typescript shim
  Add tests for lazy syntax trees coming from the GeneratorDriver
  React to code review feedback.
  Simplify the lazy-initalization pattern used in GetRoot
  Remove an unnecessary override. (dotnet#52140)
  Update issue number (dotnet#52130)
  Enable CodeActions support for XAML using its own provider and CodeActionCache. The handlers are actually shared with Roslyn as is. (dotnet#52129)
  Add RestrictedIVT to dotnet watch to Features (dotnet#52087)
  Don't try to highlight operators (dotnet#52041)
  Use `null` instead of empty signature helps in LSP
  Use member type for relational pattern even in error cases (dotnet#51950)
  Update src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Extensions/SymbolExtensions.cs
  Use new QuickInfoUtilities helper
  Rebuild API shape (dotnet#52079)
  Added position parameter name
  Updated XAML QuickInfo to show more info like C# by using ISymbolDisplayService and adding more documentation parts.
  ...
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctrl+shift+down stops at ++

5 participants