This commit is contained in:
hrsh7th
2021-11-02 12:05:47 +09:00
parent 017d3abc57
commit b4e761e307

View File

@@ -74,21 +74,16 @@ end
---@param name string ---@param name string
---@return cmp.SourceConfig ---@return cmp.SourceConfig
config.get_source_config = function(name) config.get_source_config = function(name)
local bufnr = vim.api.nvim_get_current_buf() local c = config.get()
local global = config.global for _, s in ipairs(c.sources) do
local buffer = config.buffers[bufnr] or { revision = 1 } if s.name == name then
return config.cache:ensure({ 'get_source_config', bufnr, global.revision or 0, buffer.revision or 0, name }, function() if type(s.opts) ~= 'table' then
local c = config.get() s.opts = {}
for _, s in ipairs(c.sources) do
if s.name == name then
if type(s.opts) ~= 'table' then
s.opts = {}
end
return s
end end
return s
end end
return nil end
end) return nil
end end
---Normalize mapping key ---Normalize mapping key