-
Notifications
You must be signed in to change notification settings - Fork 187
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
Lsp snippets complete #193
Comments
Thanks for the issue! Sorry, but this is not supported and, probably, won't be supported until there is a 'mini.snippets' module. The main reason is because it is hard to implement this functionality right. Seems like the reason why you see this in your setup is because you LSP server (
I am not sure what you mean here by "it works". I tried it with 'sumneko_lua' and it does indeed suggest "Snippet" entries which don't expand properly. You'd need snippet engine for that (like L3MON4D3/LuaSnip. |
Thank you for quick response. --local on_attach = function(_, bufnr)
-- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.MiniCompletion.completefunc_lsp')
--end
local on_attach = function()
vim.opt_local.omnifunc = 'v:lua.vim.lsp.omnifunc'
end I can get suggestions with RecApp-2023-01-11-14.38.50.mp4 |
Hmm... This might be due to (not so recently) added built-in snippet parsing using I am hesitant to add this, as snippets are not currently supported at all. I'll think about it. |
Ok! Thanks again for ❤️ mini plugins. If you want you can close issue. |
Yes, I think I'll close this, as 'mini.completion' is not designed (yet, maybe?) to support snippets and this example does seem to come from a misbehaved LSP server (returning snippet-like completion entry as "Property"). |
@echasnovski thank you for your amazing work. Checking in on this as I just started using mini.completion. But I am a bit confused as every LSP I have tried so far when selecting a function will provide placeholder "snippet" locations for function parameters / arguments. Most notably Lua and TypeScript. Am I doing something wrong or is this expected and I need to manually go remove / fill in each parameter replacing the Is there a way that I could at least just finish the function and not have the placeholders added at all? even if for I have luasnip installed as well but cannot get it to work with it either. Maybe I am just doing something wrong? Thanks again for great work :-) |
Ideally, it should not place those placeholders inside parenthesis. I can not reproduce with my setup, so could you please somehow share how you set up both 'mini.completion' and LSP for Lua? Preferably in a minimal reproduction 'init.lua' which only contains code enough to reproduce the issue. |
@echasnovski as I am diving into this I believe this could be a windows issue and compatibility with the required See here from luasnip: https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#transformations See here from kickstart where they essentially say that they could not figure out how to make it windows compatible: nvim-lua/kickstart.nvim#611 (comment) And here is an issue in luasnip repo about windows: L3MON4D3/LuaSnip#986 This all being said, what options do I have assuming we are stuck with the function parameter snippet syntax coming through? is there a callback/hook we can utilize on selection of a completion item where I could either parse myself, or just clear out the function (params) and just return function() or function? Honestly the parsing should be quite simple for @echasnovski thoughts? |
I am not sure how LuaSnip is relevant here, as 'mini.completion' does not integrate with any snippet engines (right now). So if this result is from 'mini.completion', then it has to come from LSP server. And currently I am not sure what config can reproduce this issue (preferably on Linux, as I don't have access to Windows). |
I was under the assumption that LuaSnip actually hooked itself into the LSP and essentially "intercepted" and did something with handling of LSP function snippets. But that is likely a poor assumption. |
@echasnovski maybe it would help if I knew what it is supposed to look like simply with Lua as the LSP source when you are autocompleting lets say WindowsTerminal.-.PowerShell_yUODEAn5jU_2024-03-25_14-43-52.mp4 |
I don't think it does that.
It should work more or less the same but without adding parenthesis (with their contents) when navigating through the completion suggestions. For hands-on example, you disable 'mini.completion' (not load in 'init.lua') and instead have For this to be more productive, at least some reproducible setup (OS, Neovim version, config, and exact steps) would indeed help. |
@echasnovski is it sufficient to tell you i am on windows 11, using nightly nvim and can reproduce with kickstart? I believe you know tj and i'm sure are familiar with the project? I cloned this in a fresh nvim: https://github.com/nvim-lua/kickstart.nvim And then simply disabled nvim-cmp and added mini.completion with the default setup config. Here is a branch straight from kickstart with just 2 commits to disable cmp and add mini.completion: https://github.com/GitMurf/kickstart.nvim/tree/2024_03/mini.completion-troubleshoot |
Sorry it took so long to look at. A quick search for "completion" in the 'init.lua' showed me that |
Thanks for investigating! Makes sense. But the weird thing is my typescript lsp is doing the same thing and I did not change any configuration for it. Any ideas of why typescript may be? Could it be doing the "replace" out of the box? |
Typescript language server is a bit of a mystery to me, to be honest. I think I saw an instance or two when completion item was declared as not having "Snippet" kind but expanded into a snippet. All in all, I am fairly certain that this is an issue with LSP server (either how it is set up or its internals) and not 'mini.completion' itself. |
Contributing guidelines
Module(s)
mini.completion
Description
Hi! I really like this plugin.
It is simple and effective.
It's fast and has everything I need except for one thing:
If cssls or cssmodules_ls is active, the server snippets it delivers expand but do
not stop at the placeholder.
RecApp-2023-01-11-10.20.54.mp4
This is my minimal config:
Without mini.completion using omnifunc
<C-x><C-o>
and this setting:
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
it works.
My request is if you can help me achieve this result with mini completion plugin.
Thank you very much for your beautiful work.
The text was updated successfully, but these errors were encountered: