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

Add support for textDocument/implementation in LSP mode #1970

Merged

Conversation

arjenwitteveen
Copy link
Contributor

This change adds the LSP handler for the textDocument/implementation feature (resolves #1853) and tests to go along with it. I tried the feature in Emacs using the lsp-mode package with success.

Writing the handler seemed straightforward. I based the new test class on ReferenceHandlerFacts.cs (I wasn't sure which naming convention to follow, i.e., using the OmniSharp prefix or not; based on the existing test files I chose to include the prefix).

The null check with early return in FindImplementationsService.cs was needed since a NullReferenceException would occur when checking !symbol.IsAbstract when a request was done without pointing at a symbol (the test CannotFindImplementationsWithoutSymbol checks this case).

@dnfadmin
Copy link

dnfadmin commented Oct 3, 2020

CLA assistant check
All CLA requirements met.

@arjenwitteveen arjenwitteveen marked this pull request as ready for review October 3, 2020 08:00
@@ -39,6 +39,11 @@ public async Task<QuickFixResponse> Handle(FindImplementationsRequest request)
var quickFixes = new List<QuickFix>();
var symbol = await SymbolFinder.FindSymbolAtPositionAsync(semanticModel, position, _workspace);

if (symbol == null)
Copy link
Member

Choose a reason for hiding this comment

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

ugh I can't believe it wasn't there already

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 thanks

@david-driscoll
Copy link
Member

@arjenwitteveen thank you so much!

You probably did the exact same thing I would have done (use references as the base!).

🎈 🎉

@david-driscoll david-driscoll merged commit 73292ab into OmniSharp:master Oct 8, 2020
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.

[lsp] Implement textDocument/implementation
4 participants