Simple way to integrate mini.completion
and vim.snippet.expand
?
#1414
-
First of all, @echasnovski did an incredible job, and I’m using The question is: How can I (if possible) do a simple expansion of those cases using the I'm using this process_items function: require('mini.completion').setup({
window = {
info = { border = "single" },
signature = { border = "single" }
},
lsp_completion = {
process_items = function(items, base)
local res = vim.tbl_filter(
function(item)
return vim.startswith(
((item.textEdit or {}).newText or item.insertText or item.label or ''), base)
end, items)
table.sort(res, function(a, b) return (a.sortText or a.label) < (b.sortText or b.label) end)
return res
end
}
}) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Thanks for the appreciation! It means a lot!
Snippets is a big part of my text editing and I can't recommend enough to invest some time in setting them. That's why I was trying really hard to have 'mini.snippets' that is user-friendly, capable, and robust. Its development is in its final stretch, after which I hope to spend time for 'mini.completion' to finally have snippet support.
Take a look at #1277, in particular this comment for why this happens) and this comment for how to fix it). For a well behaved server this should do what you ask: not insert snippet for a not "Snippet" completion kind (just text). Does this solve the issue? |
Beta Was this translation helpful? Give feedback.
-
Hi @echasnovski, I've been loving -- init.lua
require('lspconfig').clangd.setup({})
require('mini.basics').setup()
local gen_loader = require('mini.snippets').gen_loader
require('mini.snippets').setup({ snippets = { gen_loader.from_lang() } })
require('mini.completion').setup()
-- ~/.config/nvim/
-- ├── init.lua
-- └── pack/vendor/start/
-- ├── mini.nvim/
-- │ └── ... // cloned from https://github.com/echasnovski/mini.nvim
-- ├── nvim-lspconfig/
-- │ └── ... // cloned from https://github.com/neovim/nvim-lspconfig
-- └── friendly-snippets/
-- └── ... // cloned from https://github.com/rafamadriz/friendly-snippets With this config I'm getting autocomplete and I'm able to expand snippets with |
Beta Was this translation helpful? Give feedback.
Thanks for the appreciation! It means a lot!
Snippets is a big part of my text editing and I can't recommend enough to invest some time in setting them. That's why I was trying really hard to have 'mini.snippets' that is user-friendly, capable, and robust. Its development is in its final stretch, after which I hope to spend time for 'mini.completion' to finally have snippet support.