[mini.completion] Weird interaction with empty complete opt #2474
-
Contributing guidelines
Module(s)mini.completion QuestionIf I set Has anybody observed this? Here's my mini.completion config. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Looking at the linked config, I think the important part is this commented section: -- Trigger LSP completion directly to prevent buffer text fallback
-- vim.api.nvim_create_autocmd("LspAttach", {
-- callback = function(args)
-- vim.bo[args.buf].complete = "" -- disable words completion
-- end,
-- })So the goal is not just “empty complete for no reason”, but to prevent Neovim from falling back to buffer/keyword completion and use LSP completion only. That goal makes sense, but I suspect complete = "" is too strong. mini.completion still uses Neovim’s built-in insert-completion mechanism, with omnifunc set to v:lua.MiniCompletion.completefunc_lsp in your config. If complete is empty, / can end up in an unusual state where completion is triggered but there are no normal completion sources configured. That may explain why literal ^N characters appear. Instead of clearing complete, I would try keeping only omni completion as the source: vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
vim.bo[args.buf].complete = "o"
end,
})or test it manually: :setlocal complete=o
:verbose setlocal complete?
:verbose setlocal omnifunc?This should keep completion routed through omnifunc / MiniCompletion.completefunc_lsp, while avoiding the buffer-word fallback sources. So my current guess is:
If complete=o still falls back to buffer words, then the next thing to inspect would be the exact mappings / completeopt state, but I would try that before treating this as a mini.completion bug. |
Beta Was this translation helpful? Give feedback.
-
|
Indeed, this is working as expected because 'mini.completion' here tries two things in succession: ask LSP server(s) about completion data, perform fallback action if there is none. The default fallback action is emulating To disable fallback completion locally to buffer, set |
Beta Was this translation helpful? Give feedback.
Good point, then my previous guess was incomplete.
If
complete=ostill gives what looks like buffer completion, I think the more relevant part is probablymini.completion’s fallback behavior, not only the value of complete.mini.completionis a two-stage completion system:and the default fallback action is:
fallback_action = ''
So even if your LSP setup is correct, when LSP returns no candidates, mini.completion can still fall back to Neovim’s built-in completion. That would explain why you still see buffer-like completion with complete=o, and also why unusual complete values like complete="" or complete=k can produ…