fix: misc typos #37471

This commit is contained in:
phanium
2026-01-27 22:18:02 +08:00
committed by GitHub
parent ae93639ec4
commit dfa5d79d05
6 changed files with 14 additions and 12 deletions

View File

@@ -1479,8 +1479,8 @@ vim.schedule_wrap({fn}) *vim.schedule_wrap()*
*vim.str_byteindex()* *vim.str_byteindex()*
vim.str_byteindex({s}, {encoding}, {index}, {strict_indexing}) vim.str_byteindex({s}, {encoding}, {index}, {strict_indexing})
Convert UTF-32, UTF-16 or UTF-8 {index} to byte index. If Convert UTF-32, UTF-16 or UTF-8 {index} to byte index. If
{strict_indexing} is false then then an out of range index will return {strict_indexing} is false then an out of range index will return byte
byte length instead of throwing an error. length instead of throwing an error.
Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. An {index} Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. An {index}
in the middle of a UTF-16 sequence is rounded upwards to the end of that in the middle of a UTF-16 sequence is rounded upwards to the end of that
@@ -4170,7 +4170,7 @@ Provides operations to compare, calculate, and convert ranges represented by
|Range:has()|. |Range:has()|.
• {intersect} (`fun(r1: vim.Range, r2: vim.Range): vim.Range?`) See • {intersect} (`fun(r1: vim.Range, r2: vim.Range): vim.Range?`) See
|Range:intersect()|. |Range:intersect()|.
• {to_lsp} (`fun(range: vim.Range, position_encoding: lsp.PositionEncodingKind)`) • {to_lsp} (`fun(range: vim.Range, position_encoding: lsp.PositionEncodingKind): lsp.Range`)
See |Range:to_lsp()|. See |Range:to_lsp()|.
• {lsp} (`fun(buf: integer, range: lsp.Range, position_encoding: lsp.PositionEncodingKind)`) • {lsp} (`fun(buf: integer, range: lsp.Range, position_encoding: lsp.PositionEncodingKind)`)
See |Range:lsp()|. See |Range:lsp()|.
@@ -4238,6 +4238,9 @@ Range:to_lsp({range}, {position_encoding}) *Range:to_lsp()*
• {range} (`vim.Range`) See |vim.Range|. • {range} (`vim.Range`) See |vim.Range|.
• {position_encoding} (`lsp.PositionEncodingKind`) • {position_encoding} (`lsp.PositionEncodingKind`)
Return: ~
(`lsp.Range`)
============================================================================== ==============================================================================
Lua module: vim.re *vim.re* Lua module: vim.re *vim.re*

View File

@@ -16,7 +16,7 @@ vim.o.number = true
-- option above, see `:h number_relativenumber` -- option above, see `:h number_relativenumber`
vim.o.relativenumber = true vim.o.relativenumber = true
-- Sync clipboard between OS and Neovim. Schedule the setting after `UiEnter` because it can -- Sync clipboard between OS and Neovim. Schedule the setting after `UIEnter` because it can
-- increase startup-time. Remove this option if you want your OS clipboard to remain independent. -- increase startup-time. Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'` -- See `:help 'clipboard'`
vim.api.nvim_create_autocmd('UIEnter', { vim.api.nvim_create_autocmd('UIEnter', {

View File

@@ -655,7 +655,7 @@ end
--- Convert UTF-32, UTF-16 or UTF-8 {index} to byte index. --- Convert UTF-32, UTF-16 or UTF-8 {index} to byte index.
--- If {strict_indexing} is false --- If {strict_indexing} is false
--- then then an out of range index will return byte length --- then an out of range index will return byte length
--- instead of throwing an error. --- instead of throwing an error.
--- ---
--- Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. --- Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|.

View File

@@ -809,8 +809,8 @@ function M.relpath(base, target, opts)
vim.validate('target', target, 'string') vim.validate('target', target, 'string')
vim.validate('opts', opts, 'table', true) vim.validate('opts', opts, 'table', true)
base = vim.fs.normalize(vim.fs.abspath(base)) base = M.normalize(M.abspath(base))
target = vim.fs.normalize(vim.fs.abspath(target)) target = M.normalize(M.abspath(target))
if base == target then if base == target then
return '.' return '.'
end end

View File

@@ -15,11 +15,9 @@ local M = {}
--- completion. The `body` field in the response object contains the raw response data (text or binary). --- completion. The `body` field in the response object contains the raw response data (text or binary).
--- Called with (err, nil) on failure, or (nil, { body = string|boolean }) on success. --- Called with (err, nil) on failure, or (nil, { body = string|boolean }) on success.
function M.request(url, opts, on_response) function M.request(url, opts, on_response)
vim.validate({ vim.validate('url', url, 'string')
url = { url, 'string' }, vim.validate('opts', opts, 'table', true)
opts = { opts, 'table', true }, vim.validate('on_response', on_response, 'function')
on_response = { on_response, 'function' },
})
opts = opts or {} opts = opts or {}
local retry = opts.retry or 3 local retry = opts.retry or 3

View File

@@ -143,6 +143,7 @@ end
--- ``` --- ```
---@param range vim.Range ---@param range vim.Range
---@param position_encoding lsp.PositionEncodingKind ---@param position_encoding lsp.PositionEncodingKind
---@return lsp.Range
function Range.to_lsp(range, position_encoding) function Range.to_lsp(range, position_encoding)
validate('range', range, 'table') validate('range', range, 'table')
validate('position_encoding', position_encoding, 'string', true) validate('position_encoding', position_encoding, 'string', true)