diff --git a/doc/lz.n.txt b/doc/lz.n.txt index 9a4a74c..677baf2 100644 --- a/doc/lz.n.txt +++ b/doc/lz.n.txt @@ -237,17 +237,20 @@ state.new() *state.new* (lz.n.handler.State) +lz.n.handler.State *lz.n.handler.State* + + lz.n.handler.State *lz.n.handler.State* Fields: ~ - {insert} (fun(key?:string,plugin:lz.n.Plugin)) - Insert a plugin (optionally, by key). + {insert} (fun(key:string,plugin:lz.n.Plugin)|fun(plugin:lz.n.Plugin)) + Insert a plugin (optionally, by key). {del} (fun(plugin_name:string,callback?:fun(key:string))) - Remove a plugin by its name. + Remove a plugin by its name. {has_pending_plugins} (fun(key?:string):boolean) - Check if there are pending plugins (optionally, by key) + Check if there are pending plugins (optionally, by key) {lookup_plugin} (fun(plugin_name:string):lz.n.Plugin) - Lookup a plugin by its name. + Lookup a plugin by its name. vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/lua/lz/n/handler/state.lua b/lua/lz/n/handler/state.lua index 7b567e9..75c38e6 100644 --- a/lua/lz/n/handler/state.lua +++ b/lua/lz/n/handler/state.lua @@ -15,7 +15,7 @@ function state.new() local DEFAULT_KEY = "lz.n.handler.State.DEFAULT_KEY" - ---@type lz.n.handler.State + ---@class lz.n.handler.State return { ---@overload fun(key: string, plugin: lz.n.Plugin) ---@overload fun(plugin: lz.n.Plugin) @@ -87,7 +87,7 @@ end ---@class lz.n.handler.State --- ---Insert a plugin (optionally, by key). ----@field insert fun(key?: string, plugin: lz.n.Plugin) +---@field insert fun(key: string, plugin: lz.n.Plugin) | fun(plugin: lz.n.Plugin) --- ---Remove a plugin by its name. ---@field del fun(plugin_name: string, callback?: fun(key: string)) @@ -100,6 +100,6 @@ end --- ---Safely apply a callback to all pending plugins ---(optionally, by key). ----@field each_pending fun(key?: string, callback: fun(plugin: lz.n.Plugin)): string[] +---@field each_pending fun(key: string, callback: fun(plugin: lz.n.Plugin)): string[] | fun(callback: fun(plugin: lz.n.Plugin)): string[] return state