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

Fix finding references to operator overloads #1371

Merged

Conversation

SirIntruder
Copy link
Contributor

Currently, operator overloads have code lens, but number of references is always zero, and invoking findUsages directly (as in shift+f12) doesn't work either.

Roslyn returns references correctly, but FindUsagesService filters them out because "CanBeReferencedByName" is false. This filtering was previously ignored if method is constructor, and I 've added additional ignore for operators.

Added one test in FindUsagesFact for this case.

I think I saw that this filtering was added to go around some issue with get/set being returned as references to property, but I can't find that issue/PR.

Additional notes:

  1. Implicit/explicit conversion has similar problem - codeLens with constant 0 references. Problem is, this appears to be downstream, it doesn't work in VS either and I couldn't make it to work here.

  2. It would be nice if we could have find references to get/set, as in here Suggestion: Find-Refs on a setter should only find write-references to that property. dotnet/roslyn#17684. I see how to check if methodKind on invoked symbol is get or set, but I don't see a way to force SymbolFinder.FindReferencesAsync to return only read/write usages. Anyone has an idea?

Copy link
Member

@filipw filipw left a comment

Choose a reason for hiding this comment

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

LGTM

@rchande rchande merged commit dd6eccd into OmniSharp:master Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants