aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/keymap.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2026-09-25 17:07:21 +0100
committerLewis Russell <lewis6991@gmail.com>2026-09-25 17:07:21 +0100
commitffa782066c2e02a068171963aded4bb300c25663 (patch)
tree9d8bfec14e7f28909af9981b5228c7b51f841b3d /runtime/lua/vim/keymap.lua
parent7e8ad7c52ac28c01563128d8f43996512676324c (diff)
downloadrneovim-ffa782066c2e02a068171963aded4bb300c25663.tar.gz
rneovim-ffa782066c2e02a068171963aded4bb300c25663.tar.bz2
rneovim-ffa782066c2e02a068171963aded4bb300c25663.zip
fix(lua): enable assignment type checking in runtime code
Enable EmmyLua's assign-type-mismatch diagnostic after correcting the runtime annotations and assignments it flags. Correct option, tuple, and return types, and use separate locals when a value changes representation. Add guards and narrow casts where needed so the runtime passes the stricter check. Regenerate the affected docs. AI-assisted
Diffstat (limited to 'runtime/lua/vim/keymap.lua')
-rw-r--r--runtime/lua/vim/keymap.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index 061d3340fe..2805bbe8dd 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -71,10 +71,10 @@ function keymap.set(modes, lhs, rhs, opts)
opts = vim.deepcopy(opts or {}, true)
- ---@cast modes string[]
modes = type(modes) == 'string' and { modes } or modes
- ---@cast lhs string[]
+ ---@cast modes string[]
lhs = type(lhs) == 'string' and { lhs } or lhs
+ ---@cast lhs string[]
if opts.expr and opts.replace_keycodes ~= false then
opts.replace_keycodes = true
@@ -143,10 +143,10 @@ function keymap.del(modes, lhs, opts)
opts = opts or {}
- --- @cast modes string[]
modes = type(modes) == 'string' and { modes } or modes
- ---@cast lhs string[]
+ --- @cast modes string[]
lhs = type(lhs) == 'string' and { lhs } or lhs
+ ---@cast lhs string[]
local buf = opts.buf
--- @cast opts +{buffer?:integer|boolean}