However this isn't working. I've also tried this with no success:
opts = function(_, opts)
if not opts.lsp_handlers then
opts.lsp_handlers = {}
end
local definition_event = "textDocument/definition"
local definition_event_original = opts.lsp_handlers[definition_event] or vim.lsp.handlers[definition_event]
opts.lsp_handlers[definition_event] = function(err, result, ctx, config)
print("Definition handler")
local client = vim.lsp.get_client_by_id(ctx.client_id)
if client and vim.tbl_contains({
"csharp_ls",
}, client.name) then
require("csharpls_extended").handler(err, result, ctx, config)
end
definition_event_original(err, result, ctx, config)
end
local type_definition_event = "textDocument/typeDefinition"
local type_definition_event_original = opts.lsp_handlers[type_definition_event]
or vim.lsp.handlers[type_definition_event]
opts.lsp_handlers[type_definition_event] = function(err, result, ctx, config)
print("TypeDefinition handler")
local client = vim.lsp.get_client_by_id(ctx.client_id)
if client and vim.tbl_contains({
"csharp_ls",
}, client.name) then
require("csharpls_extended").handler(err, result, ctx, config)
end
type_definition_event_original(err, result, ctx, config)
end
end,
Is your feature related to a problem?
I would like go to definition to work properly with C#, needs https://github.com/Decodetalkers/csharpls-extended-lsp.nvim.
Doing
:lua require('csharpls_extended').lsp_definitions()
on a symbol makes it go to the decompiled version.Describe the new feature
Go to definition will work for non-project code in C#.
Additional context
I have tried setting it up to override the
textDocument/definition
lsp_handler like so:However this isn't working. I've also tried this with no success: