Skip to content

Commit

Permalink
fix: order loading env variables from shell
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Dec 27, 2023
1 parent 7267fb5 commit e82cb22
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lua/cmp-dotenv/dotenv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ function M.load()

table.sort(files, opts.file_priority)

if opts.load_shell then
local env_vars = vim.fn.environ()
for key, value in pairs(env_vars) do
M.env_variables[key] = { value = value, docs = '**From Shell**' }
end
end

for i = 1, #files do
local file = files[i]
local data = load.load_data(file, false)
for key, v in pairs(data) do
M.set_env_variable(key, v.value, v.docs)
end
end

if opts.load_shell then
local env_vars = vim.fn.environ()
for key, value in pairs(env_vars) do
M.env_variables[key] = { value = value, docs = '**From Shell**' }
end
end
end

function M.as_completion()
Expand Down

0 comments on commit e82cb22

Please sign in to comment.