From cb828db500077b4a948f1dcff793d10bca8dc289 Mon Sep 17 00:00:00 2001 From: Cesar Enrique Ramirez Date: Thu, 1 Aug 2024 13:14:08 +0200 Subject: [PATCH] fix(env): early return causing nil env table error --- lua/kulala/parser/env.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/kulala/parser/env.lua b/lua/kulala/parser/env.lua index 6c08f3a..9c5c9f9 100644 --- a/lua/kulala/parser/env.lua +++ b/lua/kulala/parser/env.lua @@ -31,12 +31,12 @@ M.get_env = function() elseif dotenv then local dotenv_env = vim.fn.readfile(dotenv) for _, line in ipairs(dotenv_env) do - if line:match("^%s*$") or line:match("^%s*#") then - return - end - local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$") - if key and value then - env[key] = value + -- if the line is not empy and not a comment, then + if not line:match("^%s*$") and not line:match("^%s*#") then + local key, value = line:match("^%s*([^=]+)%s*=%s*(.*)%s*$") + if key and value then + env[key] = value + end end end end