Completing functions snippets with tabstops #731
-
Hey friends! Hope you are well! In the intro page for this repo in the video: Kapture.2021-10-27.at.13.32.44.mp4 You can see a function being expanded and tab being used to quickly cycle through the function arguments to populate them. Does anyone know how to get this functionality working and the list of plugins to do so? I've tried stringing together nvim-cmp with snippy and with luasnip and can only tab through code snippets and not a function that I've written being called or even a function that's part of the standard library in the language (e.g. table.insert in lua which works in the demo video). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
My sumneko lua settings are the following. require'lspconfig'.sumneko_lua.setup {
on_init = on_init;
capabilities = capabilities,
cmd = {
vim.fn.expand('~/Develop/Repo/lua-language-server/bin/macOS/lua-language-server'),
"-E",
vim.fn.expand('~/Develop/Repo/lua-language-server/main.lua'),
};
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
completion = {
callSnippet = 'Replace',
},
diagnostics = {
enable = true,
globals = {
"vim", "describe", "it", "before_each", "after_each"
}
},
workspace = {
library = {
vim.fn.expand('$VIMRUNTIME/lua'),
vim.fn.expand('$VIMRUNTIME/lua/vim/lsp'),
},
},
},
},
} |
Beta Was this translation helpful? Give feedback.
-
That was it, specifically this setting: settings = {Lua = {completion = {callSnippet = 'Replace'}}} Fixed it and I was able to automatically fix lua function signatures with tabstops like in the demo. Thank you so much! Do you know if there's anyway this can be generalized to other languages or is this heavily dependent on the LSP server? |
Beta Was this translation helpful? Give feedback.
My sumneko lua settings are the following.