mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-16 11:00:23 +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 utils = require("harpoon.utils")
|
||||||
local HarpoonGroup = require("harpoon.autocmd")
|
local HarpoonGroup = require("harpoon.autocmd")
|
||||||
|
|
||||||
@ -18,17 +17,16 @@ end
|
|||||||
|
|
||||||
function M.run_select_command()
|
function M.run_select_command()
|
||||||
local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
harpoon.logger:log('select by keymap \'<CR>\'')
|
harpoon.logger:log("select by keymap '<CR>'")
|
||||||
harpoon.ui:select_menu_item()
|
harpoon.ui:select_menu_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.run_toggle_command(key)
|
function M.run_toggle_command(key)
|
||||||
local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
harpoon.logger:log('toggle by keymap \'' .. key .. '\'')
|
harpoon.logger:log("toggle by keymap '" .. key .. "'")
|
||||||
harpoon.ui:select_menu_item()
|
harpoon.ui:select_menu_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---TODO: I don't know how to do what i want to do, but i want to be able to
|
---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
|
---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
|
---strings back into the ui. it feels gross and it puts odd coupling
|
||||||
|
@ -56,7 +56,16 @@ function M.get_default_config()
|
|||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
save_on_toggle = false,
|
save_on_toggle = false,
|
||||||
border_chars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
border_chars = {
|
||||||
|
"─",
|
||||||
|
"│",
|
||||||
|
"─",
|
||||||
|
"│",
|
||||||
|
"╭",
|
||||||
|
"╮",
|
||||||
|
"╯",
|
||||||
|
"╰",
|
||||||
|
},
|
||||||
ui_fallback_width = 69,
|
ui_fallback_width = 69,
|
||||||
ui_width_ratio = 0.62569,
|
ui_width_ratio = 0.62569,
|
||||||
key = function()
|
key = function()
|
||||||
@ -85,12 +94,18 @@ function M.get_default_config()
|
|||||||
return list_item.value
|
return list_item.value
|
||||||
end,
|
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_item? HarpoonListFileItem
|
||||||
---@param list HarpoonList
|
---@param list HarpoonList
|
||||||
---@param options HarpoonListFileOptions
|
---@param options HarpoonListFileOptions
|
||||||
select = function(list_item, list, options)
|
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 {}
|
options = options or {}
|
||||||
if list_item == nil then
|
if list_item == nil then
|
||||||
return
|
return
|
||||||
@ -185,7 +200,6 @@ function M.get_default_config()
|
|||||||
|
|
||||||
item.context.row = pos[1]
|
item.context.row = pos[1]
|
||||||
item.context.col = pos[2]
|
item.context.col = pos[2]
|
||||||
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
local Log = require("harpoon.logger")
|
|
||||||
local Listeners = require("harpoon.listeners")
|
local Listeners = require("harpoon.listeners")
|
||||||
|
|
||||||
local function index_of(items, element, config)
|
local function index_of(items, element, config)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
---@class HarpoonLog
|
---@class HarpoonLog
|
||||||
---@field lines string[]
|
---@field lines string[]
|
||||||
local HarpoonLog = {}
|
local HarpoonLog = {}
|
||||||
@ -16,7 +15,6 @@ end
|
|||||||
|
|
||||||
---@vararg any
|
---@vararg any
|
||||||
function HarpoonLog:log(...)
|
function HarpoonLog:log(...)
|
||||||
|
|
||||||
local msg = {}
|
local msg = {}
|
||||||
for i = 1, select("#", ...) do
|
for i = 1, select("#", ...) do
|
||||||
local item = select(i, ...)
|
local item = select(i, ...)
|
||||||
|
@ -52,7 +52,7 @@ describe("list", function()
|
|||||||
local barc = Config.get_config(config, "bar")
|
local barc = Config.get_config(config, "bar")
|
||||||
|
|
||||||
local foo = List.decode(fooc, "foo", {})
|
local foo = List.decode(fooc, "foo", {})
|
||||||
local bar = List.decode(fooc, "bar", {})
|
local bar = List.decode(barc, "bar", {})
|
||||||
|
|
||||||
foo:select(4, {})
|
foo:select(4, {})
|
||||||
bar:select(4, {})
|
bar:select(4, {})
|
||||||
|
@ -36,10 +36,15 @@ function HarpoonUI:close_menu()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.closing = true
|
self.closing = true
|
||||||
Logger:log("ui#close_menu name: ", list_name(self.active_list), "win and bufnr", {
|
Logger:log(
|
||||||
win = self.win_id,
|
"ui#close_menu name: ",
|
||||||
bufnr = self.bufnr
|
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
|
if self.bufnr ~= nil and vim.api.nvim_buf_is_valid(self.bufnr) then
|
||||||
vim.api.nvim_buf_delete(self.bufnr, { force = true })
|
vim.api.nvim_buf_delete(self.bufnr, { force = true })
|
||||||
@ -102,7 +107,6 @@ end
|
|||||||
|
|
||||||
---@param list? HarpoonList
|
---@param list? HarpoonList
|
||||||
function HarpoonUI:toggle_quick_menu(list)
|
function HarpoonUI:toggle_quick_menu(list)
|
||||||
|
|
||||||
Logger:log("ui#toggle_quick_menu", list and list.name)
|
Logger:log("ui#toggle_quick_menu", list and list.name)
|
||||||
|
|
||||||
if list == nil or self.win_id ~= nil then
|
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)
|
local list = Buffer.get_contents(self.bufnr)
|
||||||
self.active_list:resolve_displayed(list)
|
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.active_list:select(idx, options)
|
||||||
self:close_menu()
|
self:close_menu()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user