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

Cannot navigate to assembly references or imported packages inside project with nvim-lsp (works with vscode) #2077

Open
AdamBremholm opened this issue Jan 30, 2021 · 3 comments

Comments

@AdamBremholm
Copy link

I am using omnisharp as lsp for nvim-lsp and ran into this issue. All other code actions and navigation like go to defintion etc works fine within the
project but its not able to resolve assembly references or imported packages via a private nuget feed. This however works fine in vscode.

Is there some way of making this work for nvim-lsp aswell?

This is the log from omnisharp when tryign to go to defintion for an assembly:

[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:709 ]	"LSP[omnisharp]"	"client.request"	1	"textDocument/definition"	{  position = {    character = 20,    line = 67  },  textDocument = {    uri = "file:///home/adam/projects/S03E02---.NET-Core-3.1-MVC-REST-API/Startup.cs"  }}	<function 1>	1
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]	"rpc.send.payload"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/definition",  params = {    position = {      character = 20,      line = 67    },    textDocument = {      uri = "file:///home/adam/projects/S03E02---.NET-Core-3.1-MVC-REST-API/Startup.cs"    }  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for textDocument/definition | Method='textDocument/definition'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for textDocument/definition | Method='textDocument/definition'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for textDocument/definition | Method='textDocument/definition'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finding descriptors for textDocument/definition | Method='textDocument/definition'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Swapping from Serial to Parallel | From='Serial' To='Parallel'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Swapping from Serial to Parallel | From='Serial' To='Parallel'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Swapping from Serial to Parallel | From='Serial' To='Parallel'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.JsonRpc.ProcessScheduler: Swapping from Serial to Parallel | From='Serial' To='Parallel'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Completing existing request process type Serial | Type='Serial'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Completing existing request process type Serial | Type='Serial'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Completing existing request process type Serial | Type='Serial'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.JsonRpc.ProcessScheduler: Completing existing request process type Serial | Type='Serial'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:textDocument/definition:2 request for processing | Type='Parallel' Name='textDocument/definition:2'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:textDocument/definition:2 request for processing | Type='Parallel' Name='textDocument/definition:2'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:textDocument/definition:2 request for processing | Type='Parallel' Name='textDocument/definition:2'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.JsonRpc.ProcessScheduler: Queueing Parallel:textDocument/definition:2 request for processing | Type='Parallel' Name='textDocument/definition:2'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.JsonRpc.InputHandler: Starting: Processing request textDocument/definition 2 | Method='textDocument/definition' ResponseId='2'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (2) textDocument/definition | Id='2' Method='textDocument/definition'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.JsonRpc.InputHandler: Starting: Processing request textDocument/definition 2 | Method='textDocument/definition' ResponseId='2'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.JsonRpc.InputHandler: Starting: Processing request textDocument/definition 2 | Method='textDocument/definition' ResponseId='2'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.JsonRpc.InputHandler: Starting: Processing request textDocument/definition 2 | Method='textDocument/definition' ResponseId='2'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (2) textDocument/definition | Id='2' Method='textDocument/definition'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (2) textDocument/definition | Id='2' Method='textDocument/definition'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Starting: Routing Request (2) textDocument/definition | Id='2' Method='textDocument/definition'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (2) textDocument/definition in 64ms | Id='2' Method='textDocument/definition' ElapsedMilliseconds='64'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (2) textDocument/definition in 64ms | Id='2' Method='textDocument/definition' ElapsedMilliseconds='64'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (2) textDocument/definition in 64ms | Id='2' Method='textDocument/definition' ElapsedMilliseconds='64'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.LanguageServer.Shared.LspRequestRouter: Finished: Routing Request (2) textDocument/definition in 64ms | Id='2' Method='textDocument/definition' ElapsedMilliseconds='64'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "OmniSharp.Extensions.JsonRpc.InputHandler: Finished: Processing request textDocument/definition 2 in 64ms | Method='textDocument/definition' ResponseId='2' ElapsedMilliseconds='64'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:497 ]	"notification"	"window/logMessage"	{  message = "OmniSharp.Extensions.JsonRpc.InputHandler: Finished: Processing request textDocument/definition 2 in 64ms | Method='textDocument/definition' ResponseId='2' ElapsedMilliseconds='64'",  type = 4}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"window/logMessage"	{  client_id = 1,  params = {    message = "OmniSharp.Extensions.JsonRpc.InputHandler: Finished: Processing request textDocument/definition 2 in 64ms | Method='textDocument/definition' ResponseId='2' ElapsedMilliseconds='64'",    type = 4  }}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:381 ]	"OmniSharp.Extensions.JsonRpc.InputHandler: Finished: Processing request textDocument/definition 2 in 64ms | Method='textDocument/definition' ResponseId='2' ElapsedMilliseconds='64'"
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]	"decoded"	{  id = 2,  jsonrpc = "2.0",  result = {}}
[ DEBUG ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:407 ]	"default_handler"	"textDocument/definition"	{  bufnr = 1,  client_id = 1,  params = {}}
[ INFO ] 2021-01-30T21:47:12+0100 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:277 ]	"textDocument/definition"	"No location found"
@razzmatazz
Copy link
Contributor

razzmatazz commented Jan 31, 2021

This is something I have working in emacs (lsp-mode) in my private repo by:

  • using o#/metadata proprietary LSP request
  • compiling omnisharp-roslyn with this patch

Then it however needs a small patch on your lsp client just for C#.

I have copied a similar mechanism from https://github.com/emacs-lsp/lsp-java and it seems to work (for me) with the patches above applied.


So currently IMHO we are pending these changes to enable this functionality:

  • upgrade of OmniSharp.Extensions.LanguageServer to 0.19.0-beta0005 (not released yet)
    • it contains the fix to enable legacy/proprietary LSP requests to work, like o#/metadata
  • have a PR merged that exposes metadata via separate URI schema when trying to get a definition for a type available in metadata form
  • update your LSP client to handle osmd:// resource urls in your LSP client to fetch metadata/code for the type with o#/metadata in C# mode

@razzmatazz
Copy link
Contributor

Related PR is #2079

@razzmatazz
Copy link
Contributor

For reference: this is my client-side implementation for emacs-lsp:

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

No branches or pull requests

2 participants