Skip to content

Commit

Permalink
Fix onetime configuration handling
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Aug 20, 2022
1 parent 27bc575 commit db261b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/cmp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ end
---@return cmp.ConfigSchema
config.get = function()
local global_config = config.global
if config.onetime and not vim.tbl_isempty(config.onetime) then

-- The config object already has `revision` key.
if #vim.tbl_keys(config.onetime) > 1 then
local onetime_config = config.onetime
return config.cache:ensure({
'get',
Expand Down
7 changes: 7 additions & 0 deletions lua/cmp/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,16 @@ view._get_entries_view = function(self)
local c = config.get()
local v = self.custom_entries_view
if (c.view and c.view.entries and (c.view.entries.name or c.view.entries)) == 'wildmenu' then
self.custom_entries_view:close()
self.native_entries_view:close()
v = self.wildmenu_entries_view
elseif (c.view and c.view.entries and (c.view.entries.name or c.view.entries)) == 'native' then
self.custom_entries_view:close()
self.wildmenu_entries_view:close()
v = self.native_entries_view
else
self.native_entries_view:close()
self.wildmenu_entries_view:close()
end
v.event:on('change', function()
self:on_entry_change()
Expand Down

0 comments on commit db261b4

Please sign in to comment.