fix: moved extra list decode to config decode

This commit is contained in:
theprimeagen 2024-04-09 12:08:33 -06:00
parent be7470853d
commit 663e9aad24
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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