ThePrimeagen / harpoon

MIT License
6.83k stars 366 forks source link

Keep absolute path in listItem.value. Issues #563 and #566 #568

Closed sug44 closed 5 months ago

sug44 commented 5 months ago

Instead of keeping relative path in listItem.value and converting it to absolute every time you need it, this PR keeps absolute path in listItem.value and converts is to relative path only once when you need to display it in the menu. Basically stole the idea from this TODO: https://github.com/ThePrimeagen/harpoon/blob/da326d0438ac68dee9b6b62a734be940a8bd8405/lua/harpoon/config.lua#L193-L197 but instead of storing bufname it stores an absolute path, which will always make vim.fn.bufnr(path) return the right buffer number regardless of how the bufname is saved as. This PR fixes issues #563 and #566, that are both caused by comparing relative paths with absolute ones. And any future issues that are caused by forgetting to convert to an absolute path(or thinking its unnecessary). Also fixes an undocumented wierd bug that sometimes makes listItem.value be an absolute path even when the file it points to is inside the current working directory

sug44 commented 5 months ago

Just to clarify my previous PRs #564 and #567 would be unneccesary with this PR

ThePrimeagen commented 5 months ago

fix then merge