mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
chore: lint and fmt
This commit is contained in:
parent
23fe6410bc
commit
c24c7119a2
@ -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 \'<CR>\'')
|
||||
harpoon.logger:log("select by keymap '<CR>'")
|
||||
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
|
||||
|
@ -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,
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
local Log = require("harpoon.logger")
|
||||
local Listeners = require("harpoon.listeners")
|
||||
|
||||
local function index_of(items, element, config)
|
||||
|
@ -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, ...)
|
||||
|
@ -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, {})
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user