-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
feat(cs): add csharpls-extended-lsp.nvim
for better go to definition
#1018
Conversation
Review ChecklistDoes this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist: Proper conventional commit scoping:
|
testing this since I have a working dotnet env on my pc |
I'm not going to be doing C# until next Tuesday, I can test and review then |
Didnt work for me, the LSP in the pack is broken for Mac🥹 |
I think the problem is caused by telescope as mentioned here Decodetalkers/csharpls-extended-lsp.nvim#7. Maybe overriding gd to use vim.lsp.buf.definition() instead of telescope methods will solve the problem. |
The following configuration works for me. The fix is to override {
"Decodetalkers/csharpls-extended-lsp.nvim",
dependencies = {
{
"AstroNvim/astrolsp",
opts = {
config = {
csharp_ls = {
handlers = {
["textDocument/definition"] = function(...) require("csharpls_extended").handler(...) end,
["textDocument/typeDefinition"] = function(...) require("csharpls_extended").handler(...) end,
},
},
},
on_attach = function(client, bufnr)
if client.name ~= "csharp_ls" then return end
vim.keymap.set(
"n",
"gd",
vim.lsp.buf.definition,
{ buffer = bufnr, noremap = true, silent = true, desc = "Go to definition" }
)
end,
},
},
},
},
|
Thanks for pointing this out @ahmtsen ! I am going to be removing the telescope LSP mappings in the next patch release of AstroNvim because apparently there are many problems with them. Also thanks for the workaround! Once the next release is made I'll go ahead and merge this in. Also sidenote, you know you can also add {
"Decodetalkers/csharpls-extended-lsp.nvim",
dependencies = {
{
"AstroNvim/astrolsp",
opts = {
config = {
csharp_ls = {
handlers = {
["textDocument/definition"] = function(...) require("csharpls_extended").handler(...) end,
["textDocument/typeDefinition"] = function(...) require("csharpls_extended").handler(...) end,
},
on_attach = function(_, bufnr)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = bufnr, desc = "Go to definition" })
end,
},
},
},
},
},
}, |
This should work as intended now that AstroNvim v4.10.2 is released that doesn't use Telescope for LSP mappings out of the box. |
Closes #951
📑 Description
This is untested because I don't have a C# environment. @Cretezy this is the correct way to set it up, it's the same way you mentioned you tried it. If it doesn't work it could just be the plugin is broken and we shouldn't add it. Could you give this a try?
ℹ Additional Information