feat: deprecate trigger_load with lists of plugin specs

This commit is contained in:
Marc Jakobi
2024-08-28 13:24:44 +02:00
committed by Marc Jakobi
parent 163b2471e2
commit 8611566831
4 changed files with 50 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ lz.n Lua API *lz.n.api*
M.trigger_load() *M.trigger_load*
The function provides two overloads, each suited for different use cases:
@overload fun(plugins: lz.n.Plugin | string[] | lz.n.Plugin[] | table<unknown, lz.n.Plugin>)
@overload fun(plugin: lz.n.Plugin)
**Stateless version:**
- Intended for: Use by a `lz.n.Handler`
- Description: This version should be used when working with `lz.n.Handler`
@@ -29,8 +29,13 @@ M.trigger_load() *M.trigger_load*
Each handler has full authority over its internal state, ensuring it
remains isolated and unaffected by external influences,
thereby preventing multiple sources of truth.
- Note: If loading multiple plugins simultaneously,
handlers should iterate over |vim.deepcopy| of the plugins,
verifying they are still pending before each `trigger_load` call.
This practice allows for safe invocation of the stateful `trigger_load`
in `before` and `after` hooks.
@overload fun(plugins: string | string[], opts: lz.n.lookup.Opts): string[]
@overload fun(plugins: string | string[], opts?: lz.n.lookup.Opts): string[]
**Stateful version:**
- Returns: A list of plugin names that were skipped
(empty if all plugins were loaded).