Skip to content

Commit

Permalink
fix(rust): avoid resetting cmp group_index to 1 (#2332)
Browse files Browse the repository at this point in the history
For example, 'buffer' source by default has group_index = 2 [1], however
if we take all the sources plus crates and run them through
cmp.config.sources() again, since it's a one-dimensional list, all
group_indexes will be reset to 1.

[1] https://github.com/LazyVim/LazyVim/blob/879e29504d43e9f178d967ecc34d482f902e5a91/lua/lazyvim/plugins/coding.lua#L74-L80
  • Loading branch information
Frederick888 authored Jan 22, 2024
1 parent eb2674c commit f799b39
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lua/lazyvim/plugins/extras/lang/rust.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ return {
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, {
{ name = "crates" },
}))
opts.sources = opts.sources or {}
table.insert(opts.sources, { name = "crates" })
end,
},

Expand Down

0 comments on commit f799b39

Please sign in to comment.