fix: dedupe prepend

This commit is contained in:
mpaulson 2023-11-03 18:13:46 -06:00
parent 734d10bc6d
commit 65d652dccd

View File

@ -44,7 +44,11 @@ end
---@return HarpoonList ---@return HarpoonList
function HarpoonList:prepend(item) function HarpoonList:prepend(item)
item = item or self.config.add() item = item or self.config.add()
table.insert(self.items, 1, item) local index = index_of(self.config, self.items, item)
if index == -1 then
table.insert(self.items, 1, item)
end
return self return self
end end