diff --git a/lua/harpoon/config.lua b/lua/harpoon/config.lua index 5f89a2fd..6383839e 100644 --- a/lua/harpoon/config.lua +++ b/lua/harpoon/config.lua @@ -77,7 +77,12 @@ function M.get_default_config() ---@param str string ---@return HarpoonListItem decode = function(str) - return vim.json.decode(str) + local decodedItem = vim.json.decode(str) + + -- NOTE: prevents this absolute path sometimes bug by forcing + -- everything to be absolute path always + decodedItem.value = vim.loop.fs_realpath(decodedItem.value) + return decodedItem end, ---@param list_item HarpoonListItem diff --git a/lua/harpoon/list.lua b/lua/harpoon/list.lua index 1578e156..191e8632 100644 --- a/lua/harpoon/list.lua +++ b/lua/harpoon/list.lua @@ -360,11 +360,6 @@ function HarpoonList.decode(list_config, name, items) local list_items = {} for _, item in ipairs(items) do - -- this is here to prevent a breaking change by converting saved relative paths to absolute. remove after some time - local decodedItem = vim.json.decode(item) - decodedItem.value = vim.loop.fs_realpath(decodedItem.value) - item = vim.json.encode(decodedItem) - table.insert(list_items, list_config.decode(item)) end