diff --git a/lua/lazyvim/plugins/coding.lua b/lua/lazyvim/plugins/coding.lua index c6515802..c6571433 100644 --- a/lua/lazyvim/plugins/coding.lua +++ b/lua/lazyvim/plugins/coding.lua @@ -71,12 +71,13 @@ return { fallback() end, }), - sources = { - { name = "nvim_lsp", group_index = 1 }, - { name = "luasnip", group_index = 1 }, - { name = "buffer", group_index = 2 }, - { name = "path", group_index = 2 }, - }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), formatting = { format = function(_, item) local icons = require("lazyvim.config").icons.kinds @@ -94,6 +95,13 @@ return { sorting = defaults.sorting, } end, + ---@param opts cmp.ConfigSchema + config = function(_, opts) + for _, source in ipairs(opts.sources) do + source.group_index = source.group_index or 1 + end + require("cmp").setup(opts) + end, }, -- auto pairs