Compare commits

...

3 Commits

Author SHA1 Message Date
devxpain 2a21b18779
Merge 7d08321ab4 into 60cf258a9a 2024-11-10 08:01:43 +01:00
Folke Lemaitre 60cf258a9a
fix(docs): always update helptags for local plugins 2024-11-10 07:28:51 +01:00
devxpain 7d08321ab4 refactor(keys): use allowlist for valid opts
Instead of using a blacklist for specific keys, use an allowlist for valid keys in the `opts` function of `LazyKeysHandler`.
2024-10-25 14:57:18 +08:00
2 changed files with 14 additions and 3 deletions

View File

@ -24,7 +24,18 @@ local Util = require("lazy.core.util")
---@class LazyKeysHandler:LazyHandler ---@class LazyKeysHandler:LazyHandler
local M = {} local M = {}
local skip = { mode = true, id = true, ft = true, rhs = true, lhs = true } local valid = {
remap = true,
noremap = true,
buffer = true,
silent = true,
nowait = true,
expr = true,
unique = true,
script = true,
desc = true,
replace_keycodes = true,
}
---@param value string|LazyKeysSpec ---@param value string|LazyKeysSpec
---@param mode? string ---@param mode? string
@ -94,7 +105,7 @@ function M.opts(keys)
local opts = {} ---@type LazyKeysBase local opts = {} ---@type LazyKeysBase
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
for k, v in pairs(keys) do for k, v in pairs(keys) do
if type(k) ~= "number" and not skip[k] then if type(k) ~= "number" and valid[k] then
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
opts[k] = v opts[k] = v
end end

View File

@ -87,7 +87,7 @@ M.build = {
M.docs = { M.docs = {
skip = function(plugin) skip = function(plugin)
return not plugin._.dirty return not plugin._.is_local and not plugin._.dirty
end, end,
run = function(self) run = function(self)
local docs = self.plugin.dir .. "/doc" local docs = self.plugin.dir .. "/doc"