Skip to content

Commit

Permalink
fix: moved extra list decode to config decode
Browse files Browse the repository at this point in the history
  • Loading branch information
theprimeagen committed Apr 9, 2024
1 parent be74708 commit 663e9aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion lua/harpoon/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions lua/harpoon/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 663e9aa

Please sign in to comment.