From 75eb9b5c7f73b1fa0bf5b06f1ce36ffb6931ac45 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Thu, 10 Apr 2025 15:28:17 -0400 Subject: [PATCH] fix: correctly set `last` property in `snack.picker` integration --- lua/aerial/snacks.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/aerial/snacks.lua b/lua/aerial/snacks.lua index 7848d232..b94f76f3 100644 --- a/lua/aerial/snacks.lua +++ b/lua/aerial/snacks.lua @@ -26,6 +26,8 @@ M.pick_symbol = function(opts) local bufdata = data.get_or_create(bufnr) ---@type snacks.picker.finder.Item[] local items = {} + ---@type table + local last = {} for i, item in bufdata:iter({ skip_hidden = false }) do local snack_item = { idx = i, @@ -36,7 +38,13 @@ M.pick_symbol = function(opts) end_pos = { item.end_lnum, item.end_col }, } if item.parent then - snack_item.parent = items[item.parent.idx] + local parent = items[item.parent.idx] + snack_item.parent = parent + if last[parent] then + last[parent].last = nil + end + last[parent] = snack_item + snack_item.last = true end table.insert(items, snack_item) end