feat(completion): support lsp completion item.command#2372
feat(completion): support lsp completion item.command#2372echasnovski merged 1 commit intonvim-mini:backlogfrom
Conversation
|
Thanks for the PR! I am pretty sure I looked into this at least during the most recent 'mini.completion' set of improvements (LSP related and not). Don't quite remember the reason for this not being added, but vaguely remember there was one. Maybe the lack of an easy and not-that-new ( Although the code change looks reasonable. I'll take a closer look later. |
|
just for additional context this is what blink.cmp use: https://github.com/saghen/blink.cmp/blob/37c96dc06032b3f128b230b5fb193706535b3811/lua/blink/cmp/sources/lsp/init.lua#L191 from this wrapper I would assume and I looked at what nvim-cmp does, it has this stalled issue on this hrsh7th/cmp-nvim-lsp#73 |
|
Thanks again for the PR! I've merged into a temporary branch to possibly finish this myself. If at all, It'll probably be merged into |
|
@neo451, apart from 'obsidian.nvim', do you happen to know an example of a common LSP server that uses |
|
@echasnovski I believe rust-analyzer expose auto import as a server command: But I have not used it myself for a long time, so not 100% sure. |
Thanks! I've tried Is |
|
I didn't manage to find a real world LSP server that I could easily set up and reproduce it returning This should now be resolved on the |
|
ok, I confirm it indeed works very well on the main now, I was on a small trip yesterday so did not get back to you as soon as possible, and just got back home to found you work so swiftly, thank you for your awesome work! side note, now thinking about it, it does make sense that most common real world LSPs can just use additional text edits for these post actions, their editing footprint should be mostly contained in one file and be declarative, obsidian.nvim is just "abusing" it as a reliable way to run post completion accept hooks, but yeah I guess with more people writing in-process LSP plugins, this support is going to have more real world usecases in the neovim plugin ecosystem. |
Use
client:exec_cmdto runcommandfield attached to completion items, useful for additional command running, found this is not supported while obsidian-nvim/obsidian.nvim#757 and which use command to create new notes on item accept, I think many LSP servers also use it to add auto importsDid not find any discussions on it and not sure whether it is in scope, feels pretty natural to add.