razzmatazz / csharp-language-server

Roslyn-based LSP language server for C#
MIT License
538 stars 34 forks source link

Auto-import when accepting auto-completion suggestion #143

Open jakobkhansen opened 4 months ago

jakobkhansen commented 4 months ago

Hello,

I am using this LSP server in Neovim with nvim-cmp auto-completion. In many LSP servers, accepting an auto-completion suggestion will also insert the import at the top of the file. I do not get this with csharp-language-server so I have to trigger a code-action on the symbol to get the import. Is auto-importing supposed to work in csharp-language-server or is it a missing feature/bug?

I have used roslyn.nvim plugin before which directly uses Roslyn LSP server, and auto-imports are working in that one (without any code for that on the plugin-side AFAIK), so it seems to be possible to do with Roslyn?

jakobkhansen commented 4 months ago

Tested also with #141 that this does not work, so it does not work with a newer Roslyn version either.

razzmatazz commented 4 months ago

It is a missing feature/bug. IIRC the issue was that Roslyn does not (did not) provide completion APIs that does this. This may have changed since.