mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
chore: moved types around
This commit is contained in:
parent
ccf5e1cc0a
commit
2aa20a84da
@ -1,9 +1,31 @@
|
||||
local M = {}
|
||||
|
||||
---@alias HarpoonListItem {value: any, context: any}
|
||||
|
||||
---@class HarpoonPartialConfigItem
|
||||
---@field encode? (fun(list_item: HarpoonListItem): string)
|
||||
---@field decode? (fun(obj: string): any)
|
||||
---@field key? (fun(): string)
|
||||
---@field display? (fun(list_item: HarpoonListItem): string)
|
||||
---@field select? (fun(list_item: HarpoonListItem): nil)
|
||||
---@field equals? (fun(list_line_a: HarpoonListItem, list_line_b: HarpoonListItem): boolean)
|
||||
---@field add? fun(): HarpoonListItem
|
||||
|
||||
---@class HarpoonSettings
|
||||
---@field save_on_toggle boolean defaults to true
|
||||
---@field jump_to_file_location boolean defaults to true
|
||||
|
||||
---@class HarpoonConfig
|
||||
---@field default HarpoonPartialConfigItem
|
||||
---@field settings HarpoonSettings
|
||||
---@field [string] HarpoonPartialConfigItem
|
||||
|
||||
---@return HarpoonConfig
|
||||
function M.get_config(config, name)
|
||||
return vim.tbl_extend("force", {}, config.default, config[name] or {})
|
||||
end
|
||||
|
||||
---@return HarpoonConfig
|
||||
function M.get_default_config()
|
||||
return {
|
||||
settings = {
|
||||
@ -51,6 +73,9 @@ function M.get_default_config()
|
||||
}
|
||||
end
|
||||
|
||||
---@param partial_config HarpoonConfig
|
||||
---@param latest_config HarpoonConfig?
|
||||
---@return HarpoonConfig
|
||||
function M.merge_config(partial_config, latest_config)
|
||||
local config = latest_config or M.get_default_config()
|
||||
for k, v in pairs(partial_config) do
|
||||
|
@ -3,26 +3,6 @@
|
||||
-- read from a config file
|
||||
--
|
||||
|
||||
---@alias HarpoonListItem {value: any, context: any}
|
||||
|
||||
---@class HarpoonPartialConfigItem
|
||||
---@field encode? (fun(list_item: HarpoonListItem): string)
|
||||
---@field decode? (fun(obj: string): any)
|
||||
---@field key? (fun(): string)
|
||||
---@field display? (fun(list_item: HarpoonListItem): string)
|
||||
---@field select? (fun(list_item: HarpoonListItem): nil)
|
||||
---@field equals? (fun(list_line_a: HarpoonListItem, list_line_b: HarpoonListItem): boolean)
|
||||
---@field add? fun(): HarpoonListItem
|
||||
|
||||
---@class HarpoonSettings
|
||||
---@field save_on_toggle boolean defaults to true
|
||||
---@field jump_to_file_location boolean defaults to true
|
||||
|
||||
---@class HarpoonConfig
|
||||
---@field default HarpoonPartialConfigItem
|
||||
---@field settings HarpoonSettings
|
||||
---@field [string] HarpoonPartialConfigItem
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param c HarpoonConfig
|
||||
|
Loading…
x
Reference in New Issue
Block a user