Skip to content

Commit 29cfc22

Browse files
committed
refactor(hotkeys): rewrite text-diff hotkey generation
1 parent 33f0aba commit 29cfc22

File tree

2 files changed

+259
-159
lines changed

2 files changed

+259
-159
lines changed

lua/tiny-code-action/pickers/buffer_utils/display.lua

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,8 @@ function M.build_display_content(groups, config_signs, hotkey_mode, custom_keys,
4747
local line_number = 1
4848
local used_hotkeys = {}
4949

50-
local custom_key_counters = {}
51-
if custom_keys then
52-
for custom_key, _ in pairs(custom_keys) do
53-
custom_key_counters[custom_key:lower()] = 0
54-
end
55-
end
56-
5750
local sorted_categories = categories.get_sorted_categories(groups)
5851

59-
local all_action_titles = nil
60-
if hotkey_mode == "text_diff_based" then
61-
all_action_titles = {}
62-
for _, category in ipairs(sorted_categories) do
63-
local actions = groups[category]
64-
for _, action_item in ipairs(actions) do
65-
local title = action_item.action and action_item.action.title or ""
66-
table.insert(all_action_titles, { title = title, category = category })
67-
end
68-
end
69-
end
70-
7152
for _, category in ipairs(sorted_categories) do
7253
local category_label = categories.get_category_label(category)
7354
local icon = config_signs and config_signs[category] and config_signs[category][1] or ""
@@ -85,14 +66,8 @@ function M.build_display_content(groups, config_signs, hotkey_mode, custom_keys,
8566
end
8667

8768
if hotkey_enabled then
88-
local action_hotkeys = hotkeys.generate_hotkeys(
89-
titles,
90-
category,
91-
hotkey_mode,
92-
custom_keys,
93-
used_hotkeys,
94-
all_action_titles
95-
)
69+
local action_hotkeys =
70+
hotkeys.generate_hotkeys(titles, hotkey_mode, custom_keys, used_hotkeys)
9671

9772
for i, action_item in ipairs(actions) do
9873
local title = action_item.action and action_item.action.title or ""

0 commit comments

Comments
 (0)