diff --git a/lua/harpoon/buffer.lua b/lua/harpoon/buffer.lua index 54723b6..fd0e05c 100644 --- a/lua/harpoon/buffer.lua +++ b/lua/harpoon/buffer.lua @@ -1,4 +1,3 @@ -local Logger = require("harpoon.logger") local utils = require("harpoon.utils") local HarpoonGroup = require("harpoon.autocmd") @@ -18,17 +17,16 @@ end function M.run_select_command() local harpoon = require("harpoon") - harpoon.logger:log('select by keymap \'\'') + harpoon.logger:log("select by keymap ''") harpoon.ui:select_menu_item() end function M.run_toggle_command(key) local harpoon = require("harpoon") - harpoon.logger:log('toggle by keymap \'' .. key .. '\'') + harpoon.logger:log("toggle by keymap '" .. key .. "'") harpoon.ui:select_menu_item() end - ---TODO: I don't know how to do what i want to do, but i want to be able to ---make this so we use callbacks for these buffer actions instead of using ---strings back into the ui. it feels gross and it puts odd coupling diff --git a/lua/harpoon/config.lua b/lua/harpoon/config.lua index 501ffb4..3feac15 100644 --- a/lua/harpoon/config.lua +++ b/lua/harpoon/config.lua @@ -56,7 +56,16 @@ function M.get_default_config() settings = { save_on_toggle = false, - border_chars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + border_chars = { + "─", + "│", + "─", + "│", + "╭", + "╮", + "╯", + "╰", + }, ui_fallback_width = 69, ui_width_ratio = 0.62569, key = function() @@ -85,12 +94,18 @@ function M.get_default_config() return list_item.value end, - --- the select function is called when a user selects an item from the corresponding list and can be nil if select_with_nil is true + --- the select function is called when a user selects an item from + --- the corresponding list and can be nil if select_with_nil is true ---@param list_item? HarpoonListFileItem ---@param list HarpoonList ---@param options HarpoonListFileOptions select = function(list_item, list, options) - Logger:log("config_default#select", list_item, list.name, options) + Logger:log( + "config_default#select", + list_item, + list.name, + options + ) options = options or {} if list_item == nil then return @@ -185,7 +200,6 @@ function M.get_default_config() item.context.row = pos[1] item.context.col = pos[2] - end end, diff --git a/lua/harpoon/list.lua b/lua/harpoon/list.lua index 7f88949..52588d9 100644 --- a/lua/harpoon/list.lua +++ b/lua/harpoon/list.lua @@ -1,4 +1,3 @@ -local Log = require("harpoon.logger") local Listeners = require("harpoon.listeners") local function index_of(items, element, config) diff --git a/lua/harpoon/logger.lua b/lua/harpoon/logger.lua index b8d368a..6fd6f89 100644 --- a/lua/harpoon/logger.lua +++ b/lua/harpoon/logger.lua @@ -1,4 +1,3 @@ - ---@class HarpoonLog ---@field lines string[] local HarpoonLog = {} @@ -16,7 +15,6 @@ end ---@vararg any function HarpoonLog:log(...) - local msg = {} for i = 1, select("#", ...) do local item = select(i, ...) diff --git a/lua/harpoon/test/list_spec.lua b/lua/harpoon/test/list_spec.lua index 6817cda..eaaed22 100644 --- a/lua/harpoon/test/list_spec.lua +++ b/lua/harpoon/test/list_spec.lua @@ -52,7 +52,7 @@ describe("list", function() local barc = Config.get_config(config, "bar") local foo = List.decode(fooc, "foo", {}) - local bar = List.decode(fooc, "bar", {}) + local bar = List.decode(barc, "bar", {}) foo:select(4, {}) bar:select(4, {}) diff --git a/lua/harpoon/ui.lua b/lua/harpoon/ui.lua index 3e77e5c..66e682c 100644 --- a/lua/harpoon/ui.lua +++ b/lua/harpoon/ui.lua @@ -36,10 +36,15 @@ function HarpoonUI:close_menu() end self.closing = true - Logger:log("ui#close_menu name: ", list_name(self.active_list), "win and bufnr", { - win = self.win_id, - bufnr = self.bufnr - }) + Logger:log( + "ui#close_menu name: ", + list_name(self.active_list), + "win and bufnr", + { + win = self.win_id, + bufnr = self.bufnr, + } + ) if self.bufnr ~= nil and vim.api.nvim_buf_is_valid(self.bufnr) then vim.api.nvim_buf_delete(self.bufnr, { force = true }) @@ -102,7 +107,6 @@ end ---@param list? HarpoonList function HarpoonUI:toggle_quick_menu(list) - Logger:log("ui#toggle_quick_menu", list and list.name) if list == nil or self.win_id ~= nil then @@ -132,7 +136,14 @@ function HarpoonUI:select_menu_item(options) local list = Buffer.get_contents(self.bufnr) self.active_list:resolve_displayed(list) - Logger:log("ui#select_menu_item selecting item", idx, "from", list, "options", options) + Logger:log( + "ui#select_menu_item selecting item", + idx, + "from", + list, + "options", + options + ) self.active_list:select(idx, options) self:close_menu()