diff --git a/lua/hawtkeys/ts.lua b/lua/hawtkeys/ts.lua index a1a8a14..1a43acf 100644 --- a/lua/hawtkeys/ts.lua +++ b/lua/hawtkeys/ts.lua @@ -138,7 +138,11 @@ local function find_maps_in_file(filePath) if not string.match(filePath, "%.lua$") then return {} end - local fileContent = Path:new(filePath):read() + local path = Path:new(filePath) + if not path:is_file() then + return {} + end + local fileContent = path:read() local parser = vim.treesitter.get_string_parser(fileContent, "lua", {}) -- Get the Lua parser local tree = parser:parse()[1]:root() local tsKeymaps = {}