Skip to content

Commit

Permalink
fix: problems load nil cmp options
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Jan 1, 2024
1 parent c496f63 commit 37d8abe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lua/cmp-dotenv/option.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local cmp = require('cmp')
local config = require('cmp.config')

local option = {}
option.opts = nil

local defaults = {
path = '.',
Expand All @@ -18,13 +17,13 @@ local defaults = {
end,
}

function option.set(options)
option.opts = options
end

function option.get(options)
local opt = options or option.opts or config.get_source_config('dotenv').option
return vim.tbl_deep_extend('keep', opt or {}, defaults)
local cmp_opt = {}
if config and config.get_source_config('dotenv') then
cmp_opt = config.get_source_config('dotenv').option
end
local opt = options or cmp_opt
return vim.tbl_deep_extend('keep', opt, defaults)
end

return option

0 comments on commit 37d8abe

Please sign in to comment.