[mini.completion] Adding snippet to completion candidates of ItemKind Function to add parantheses and place the cursor inside #2447
-
Contributing guidelines
Module(s)mini.completion QuestionHi :) So in the meantime i'm using this to get what i want: require("mini.completion").setup({
lsp_completion = {
source_func = "omnifunc",
auto_setup = false,
process_items = function(items, base)
items = require("mini.completion").default_process_items(items, base)
local Function = vim.lsp.protocol.CompletionItemKind.Function
for _, item in ipairs(items) do
if item.kind == Function then
local text = item.insertText or item.label or ""
if not text:match("%(.-%)$") then
item.insertTextFormat = 2
item.insertText = text .. "($0)"
end
if item.textEdit and item.textEdit.newText and not item.textEdit.newText:match("%(.-%)$") then
item.textEdit.newText = item.textEdit.newText .. "($0)"
end
end
end
return items
end,
},
delay = {
completion = 25,
info = 25,
signature = 25,
},
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
LSP completion in 'mini.completion' is used as close to what LSP server provided as possible. If the server didn't mark a candidate as a snippet, then I don't think it is up to the completion provider to make choices in server's behalf. The |
Beta Was this translation helpful? Give feedback.
LSP completion in 'mini.completion' is used as close to what LSP server provided as possible. If the server didn't mark a candidate as a snippet, then I don't think it is up to the completion provider to make choices in server's behalf.
The
config.lsp_completion.process_itemsis there exactly for users to adjust LSP completion to their liking. Maybe even per LSP server by setting it in buffer-localvim.b.minicompletion_config. So if this setup works for you, it is the suggested way of handling this use case.