aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/text.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-06-05 11:31:51 +0100
committerLewis Russell <me@lewisr.dev>2025-06-06 15:36:48 +0100
commit3b6084ddf4f0d49fb0e5d135919c9daacea2a46d (patch)
treec46454da48ec05e345c953f4e172e52dff8bef52 /runtime/lua/vim/text.lua
parent4c333fdbb7bee299f36624b429f5c065470e421d (diff)
downloadrneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.tar.gz
rneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.tar.bz2
rneovim-3b6084ddf4f0d49fb0e5d135919c9daacea2a46d.zip
fix: type fixes
Type fixes caught by emmylua
Diffstat (limited to 'runtime/lua/vim/text.lua')
-rw-r--r--runtime/lua/vim/text.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua
index 93220a2e42..25126d738d 100644
--- a/runtime/lua/vim/text.lua
+++ b/runtime/lua/vim/text.lua
@@ -79,7 +79,7 @@ end
---
--- @param size integer Number of spaces.
--- @param text string Text to indent.
---- @param opts? { expandtab?: number }
+--- @param opts? { expandtab?: integer }
--- @return string # Indented text.
--- @return integer # Indent size _before_ modification.
function M.indent(size, text, opts)
@@ -91,7 +91,7 @@ function M.indent(size, text, opts)
local tabspaces = opts.expandtab and (' '):rep(opts.expandtab) or nil
--- Minimum common indent shared by all lines.
- local old_indent --[[@type number?]]
+ local old_indent --- @type integer?
local prefix = tabspaces and ' ' or nil -- Indent char (space or tab).
--- Check all non-empty lines, capturing leading whitespace (if any).
--- @diagnostic disable-next-line: no-unknown
@@ -106,7 +106,7 @@ function M.indent(size, text, opts)
end
prefix = prefix and prefix or line_ws:sub(1, 1)
local _, end_ = line_ws:find('^[' .. prefix .. ']+')
- old_indent = math.min(old_indent or math.huge, end_ or 0)
+ old_indent = math.min(old_indent or math.huge, end_ or 0) --[[@as integer?]]
end
-- Default to 0 if all lines are empty.
old_indent = old_indent or 0