emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.8k stars 892 forks source link

[Omnisharp] Port assembly introspection (aka goto decompiled type definition) from omnisharp-emacs #4210

Open btwotwo opened 1 year ago

btwotwo commented 1 year ago

Hello.

omnisharp-emacs has a really useful feature: jumping to the decompiled sources of a DLL. Unfortunately, the current implementation of lsp-mode for Omnisharp doesn't support it.

It's possible to achieve this by using an alternative implementation for the C# language server (https://github.com/razzmatazz/csharp-language-server). However, it would be great to have this feature in the 'main' language server.

Here is some useful information for those who might be interested in implementing it:

1) Apparently, this can be accomplished by checking if the response from textDocument/definition contains a $metadata$. If it does, we need to call the custom endpoint o#/metadata, which returns the full document source code. It seems that going to definitions from metadata is also possible, although it might require an additional request to o#/v2/gotodefinition. This logic is taken from a Neovim extension that supports this feature. (Last commit was in April, so it might be outdated).

2) Another point of interest might be an Omnisharp VSCode extension, you might want to check out the code that parses the gotodefinition response (https://github.com/dotnet/vscode-csharp/blob/main/src/features/definitionProvider.ts#L75).

3) And of course, the omnisharp-emacs source code that handles the request and response can be found here (https://github.com/OmniSharp/omnisharp-emacs/blob/e276ff140666057c6d6848f9cfc84a82e3a7650c/omnisharp-navigation-actions.el#L19).

If someone is interested in working on this, please feel free to share your thoughts here. Otherwise, I'll consider doing it myself at some point :)

sandao commented 5 months ago

Have you solved the problem?

btwotwo commented 4 months ago

Hi, no, not yet, haven't had time for that :)