mirror of
https://github.com/neovim/neovim.git
synced 2025-11-21 09:36:29 +00:00
chore: fix typos (#16361)
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com> Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ function F.nil_wrap(fn)
|
||||
end
|
||||
end
|
||||
|
||||
--- like {...} except preserve the lenght explicitly
|
||||
--- like {...} except preserve the length explicitly
|
||||
function F.pack_len(...)
|
||||
return {n=select('#', ...), ...}
|
||||
end
|
||||
|
||||
@@ -398,7 +398,7 @@ end)()
|
||||
|
||||
--- Converts a vimoption_T style value to a Lua value
|
||||
local convert_value_to_lua = (function()
|
||||
-- Map of OptionType to functions that take vimoption_T values and conver to lua values.
|
||||
-- Map of OptionType to functions that take vimoption_T values and convert to lua values.
|
||||
-- Each function takes (info, vim_value) -> lua_value
|
||||
local to_lua_value = {
|
||||
[OptionTypes.BOOLEAN] = function(_, value) return value end,
|
||||
|
||||
@@ -579,26 +579,7 @@ end
|
||||
--- * priority: (number, default 10) Base priority to use for signs. When
|
||||
--- {severity_sort} is used, the priority of a sign is adjusted based on
|
||||
--- its severity. Otherwise, all signs use the same priority.
|
||||
--- - float: Options for floating windows:
|
||||
--- * severity: See |diagnostic-severity|.
|
||||
--- * header: (string or table) String to use as the header for the floating
|
||||
--- window. If a table, it is interpreted as a [text, hl_group] tuple.
|
||||
--- Defaults to "Diagnostics:".
|
||||
--- * source: (string) Include the diagnostic source in
|
||||
--- the message. One of "always" or "if_many".
|
||||
--- * format: (function) A function that takes a diagnostic as input and returns a
|
||||
--- string. The return value is the text used to display the diagnostic.
|
||||
--- * prefix: (function, string, or table) Prefix each diagnostic in the floating
|
||||
--- window. If a function, it must have the signature (diagnostic, i,
|
||||
--- total) -> (string, string), where {i} is the index of the diagnostic
|
||||
--- being evaluated and {total} is the total number of diagnostics
|
||||
--- displayed in the window. The function should return a string which
|
||||
--- is prepended to each diagnostic in the window as well as an
|
||||
--- (optional) highlight group which will be used to highlight the
|
||||
--- prefix. If {prefix} is a table, it is interpreted as a [text,
|
||||
--- hl_group] tuple as in |nvim_echo()|; otherwise, if {prefix} is a
|
||||
--- string, it is prepended to each diagnostic in the window with no
|
||||
--- highlight.
|
||||
--- - float: Options for floating windows. See |vim.diagnostic.open_float()|.
|
||||
--- - update_in_insert: (default false) Update diagnostics in Insert mode (if false,
|
||||
--- diagnostics are updated on InsertLeave)
|
||||
--- - severity_sort: (default false) Sort diagnostics by severity. This affects the order in
|
||||
@@ -606,6 +587,7 @@ end
|
||||
--- are displayed before lower severities (e.g. ERROR is displayed before WARN).
|
||||
--- Options:
|
||||
--- * reverse: (boolean) Reverse sort order
|
||||
---
|
||||
---@param namespace number|nil Update the options for the given namespace. When omitted, update the
|
||||
--- global diagnostic options.
|
||||
function M.config(opts, namespace)
|
||||
@@ -800,7 +782,9 @@ end
|
||||
--- - severity: See |diagnostic-severity|.
|
||||
--- - float: (boolean or table, default true) If "true", call |vim.diagnostic.open_float()|
|
||||
--- after moving. If a table, pass the table as the {opts} parameter to
|
||||
--- |vim.diagnostic.open_float()|.
|
||||
--- |vim.diagnostic.open_float()|. Unless overridden, the float will show
|
||||
--- diagnostics at the new cursor position (as if "cursor" were passed to
|
||||
--- the "scope" option).
|
||||
--- - win_id: (number, default 0) Window ID
|
||||
function M.goto_next(opts)
|
||||
return diagnostic_move_pos(
|
||||
@@ -1164,7 +1148,17 @@ end
|
||||
--- - format: (function) A function that takes a diagnostic as input and returns a
|
||||
--- string. The return value is the text used to display the diagnostic.
|
||||
--- Overrides the setting from |vim.diagnostic.config()|.
|
||||
--- - prefix: (function, string, or table) Prefix each diagnostic in the floating window.
|
||||
--- - prefix: (function, string, or table) Prefix each diagnostic in the floating
|
||||
--- window. If a function, it must have the signature (diagnostic, i,
|
||||
--- total) -> (string, string), where {i} is the index of the diagnostic
|
||||
--- being evaluated and {total} is the total number of diagnostics
|
||||
--- displayed in the window. The function should return a string which
|
||||
--- is prepended to each diagnostic in the window as well as an
|
||||
--- (optional) highlight group which will be used to highlight the
|
||||
--- prefix. If {prefix} is a table, it is interpreted as a [text,
|
||||
--- hl_group] tuple as in |nvim_echo()|; otherwise, if {prefix} is a
|
||||
--- string, it is prepended to each diagnostic in the window with no
|
||||
--- highlight.
|
||||
--- Overrides the setting from |vim.diagnostic.config()|.
|
||||
---@return tuple ({float_bufnr}, {win_id})
|
||||
function M.open_float(bufnr, opts)
|
||||
|
||||
@@ -621,7 +621,7 @@ end
|
||||
---
|
||||
---@param commands table Table that maps string of clientside commands to user-defined functions.
|
||||
--- Commands passed to start_client take precedence over the global command registry. Each key
|
||||
--- must be a unique comand name, and the value is a function which is called if any LSP action
|
||||
--- must be a unique command name, and the value is a function which is called if any LSP action
|
||||
--- (code action, code lenses, ...) triggers the command.
|
||||
---
|
||||
---@param init_options Values to pass in the initialization request
|
||||
@@ -675,8 +675,8 @@ end
|
||||
--- notifications to the server by the given number in milliseconds. No debounce
|
||||
--- occurs if nil
|
||||
--- - exit_timeout (number, default 500): Milliseconds to wait for server to
|
||||
-- exit cleanly after sending the 'shutdown' request before sending kill -15.
|
||||
-- If set to false, nvim exits immediately after sending the 'shutdown' request to the server.
|
||||
--- exit cleanly after sending the 'shutdown' request before sending kill -15.
|
||||
--- If set to false, nvim exits immediately after sending the 'shutdown' request to the server.
|
||||
---
|
||||
---@param root_dir string Directory where the LSP
|
||||
--- server will base its workspaceFolders, rootUri, and rootPath
|
||||
@@ -1034,7 +1034,7 @@ function lsp.start_client(config)
|
||||
return rpc.notify("$/cancelRequest", { id = id })
|
||||
end
|
||||
|
||||
-- Track this so that we can escalate automatically if we've alredy tried a
|
||||
-- Track this so that we can escalate automatically if we've already tried a
|
||||
-- graceful shutdown
|
||||
local graceful_shutdown_failed = false
|
||||
---@private
|
||||
@@ -1218,7 +1218,7 @@ end
|
||||
|
||||
--- Gets a client by id, or nil if the id is invalid.
|
||||
--- The returned client may not yet be fully initialized.
|
||||
--
|
||||
---
|
||||
---@param client_id number client id
|
||||
---
|
||||
---@returns |vim.lsp.client| object, or nil
|
||||
@@ -1227,7 +1227,7 @@ function lsp.get_client_by_id(client_id)
|
||||
end
|
||||
|
||||
--- Returns list of buffers attached to client_id.
|
||||
--
|
||||
---
|
||||
---@param client_id number client id
|
||||
---@returns list of buffer ids
|
||||
function lsp.get_buffers_by_client_id(client_id)
|
||||
@@ -1331,8 +1331,8 @@ nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()")
|
||||
---@param method (string) LSP method name
|
||||
---@param params (optional, table) Parameters to send to the server
|
||||
---@param handler (optional, function) See |lsp-handler|
|
||||
-- If nil, follows resolution strategy defined in |lsp-handler-configuration|
|
||||
--
|
||||
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
|
||||
---
|
||||
---@returns 2-tuple:
|
||||
--- - Map of client-id:request-id pairs for all successful requests.
|
||||
--- - Function which can be used to cancel all the requests. You could instead
|
||||
@@ -1742,11 +1742,11 @@ end
|
||||
--- using `workspace/executeCommand`.
|
||||
---
|
||||
--- The first argument to the function will be the `Command`:
|
||||
-- Command
|
||||
-- title: String
|
||||
-- command: String
|
||||
-- arguments?: any[]
|
||||
--
|
||||
--- Command
|
||||
--- title: String
|
||||
--- command: String
|
||||
--- arguments?: any[]
|
||||
---
|
||||
--- The second argument is the `ctx` of |lsp-handler|
|
||||
lsp.commands = setmetatable({}, {
|
||||
__newindex = function(tbl, key, value)
|
||||
|
||||
@@ -222,7 +222,7 @@ function M.on_publish_diagnostics(_, result, ctx, config)
|
||||
vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id))
|
||||
end
|
||||
|
||||
--- Clear diagnotics and diagnostic cache.
|
||||
--- Clear diagnostics and diagnostic cache.
|
||||
---
|
||||
--- Diagnostic producers should prefer |vim.diagnostic.reset()|. However,
|
||||
--- this method signature is still used internally in some parts of the LSP
|
||||
|
||||
@@ -230,7 +230,7 @@ function default_dispatchers.on_error(code, err)
|
||||
end
|
||||
|
||||
--- Starts an LSP server process and create an LSP RPC client object to
|
||||
--- interact with it.
|
||||
--- interact with it. Communication with the server is currently limited to stdio.
|
||||
---
|
||||
---@param cmd (string) Command to start the LSP server.
|
||||
---@param cmd_args (table) List of additional string arguments to pass to {cmd}.
|
||||
|
||||
@@ -133,7 +133,7 @@ local function compute_start_range(prev_lines, curr_lines, firstline, lastline,
|
||||
-- occur on a new line pointed to by lastline. This occurs during insertion of
|
||||
-- new lines(O), the new newline is inserted at the line indicated by
|
||||
-- new_lastline.
|
||||
-- If firstline == new_lastline, the first change occured on a line that was deleted.
|
||||
-- If firstline == new_lastline, the first change occurred on a line that was deleted.
|
||||
-- In this case, the first byte change is also at the first byte of firstline
|
||||
if firstline == new_lastline or firstline == lastline then
|
||||
return { line_idx = firstline, byte_idx = 1, char_idx = 1 }
|
||||
@@ -187,7 +187,7 @@ end
|
||||
---@param offset_encoding string
|
||||
---@returns (int, int) end_line_idx and end_col_idx of range
|
||||
local function compute_end_range(prev_lines, curr_lines, start_range, firstline, lastline, new_lastline, offset_encoding)
|
||||
-- If firstline == new_lastline, the first change occured on a line that was deleted.
|
||||
-- If firstline == new_lastline, the first change occurred on a line that was deleted.
|
||||
-- In this case, the last_byte...
|
||||
if firstline == new_lastline then
|
||||
return { line_idx = (lastline - new_lastline + firstline), byte_idx = 1, char_idx = 1 }, { line_idx = firstline, byte_idx = 1, char_idx = 1 }
|
||||
|
||||
@@ -557,7 +557,7 @@ local function remove_unmatch_completion_items(items, prefix)
|
||||
end, items)
|
||||
end
|
||||
|
||||
--- Acording to LSP spec, if the client set `completionItemKind.valueSet`,
|
||||
--- According to LSP spec, if the client set `completionItemKind.valueSet`,
|
||||
--- the client must handle it properly even if it receives a value outside the
|
||||
--- specification.
|
||||
---
|
||||
@@ -1137,7 +1137,7 @@ function M.stylize_markdown(bufnr, contents, opts)
|
||||
markdown_lines[#stripped] = true
|
||||
end
|
||||
else
|
||||
-- strip any emty lines or separators prior to this separator in actual markdown
|
||||
-- strip any empty lines or separators prior to this separator in actual markdown
|
||||
if line:match("^---+$") then
|
||||
while markdown_lines[#stripped] and (stripped[#stripped]:match("^%s*$") or stripped[#stripped]:match("^---+$")) do
|
||||
markdown_lines[#stripped] = false
|
||||
@@ -1170,7 +1170,7 @@ function M.stylize_markdown(bufnr, contents, opts)
|
||||
|
||||
local idx = 1
|
||||
---@private
|
||||
-- keep track of syntaxes we already inlcuded.
|
||||
-- keep track of syntaxes we already included.
|
||||
-- no need to include the same syntax more than once
|
||||
local langs = {}
|
||||
local fences = get_markdown_fences()
|
||||
@@ -1306,18 +1306,18 @@ end
|
||||
---
|
||||
---@param contents table of lines to show in window
|
||||
---@param syntax string of syntax to set for opened buffer
|
||||
---@param opts dictionary with optional fields
|
||||
--- - height of floating window
|
||||
--- - width of floating window
|
||||
--- - wrap boolean enable wrapping of long lines (defaults to true)
|
||||
--- - wrap_at character to wrap at for computing height when wrap is enabled
|
||||
--- - max_width maximal width of floating window
|
||||
--- - max_height maximal height of floating window
|
||||
--- - pad_top number of lines to pad contents at top
|
||||
--- - pad_bottom number of lines to pad contents at bottom
|
||||
--- - focus_id if a popup with this id is opened, then focus it
|
||||
--- - close_events list of events that closes the floating window
|
||||
--- - focusable (boolean, default true): Make float focusable
|
||||
---@param opts table with optional fields (additional keys are passed on to |vim.api.nvim_open_win()|)
|
||||
--- - height: (number) height of floating window
|
||||
--- - width: (number) width of floating window
|
||||
--- - wrap: (boolean, default true) wrap long lines
|
||||
--- - wrap_at: (string) character to wrap at for computing height when wrap is enabled
|
||||
--- - max_width: (number) maximal width of floating window
|
||||
--- - max_height: (number) maximal height of floating window
|
||||
--- - pad_top: (number) number of lines to pad contents at top
|
||||
--- - pad_bottom: (number) number of lines to pad contents at bottom
|
||||
--- - focus_id: (string) if a popup with this id is opened, then focus it
|
||||
--- - close_events: (table) list of events that closes the floating window
|
||||
--- - focusable: (boolean, default true) Make float focusable
|
||||
---@returns bufnr,winnr buffer and window number of the newly created floating
|
||||
---preview window
|
||||
function M.open_floating_preview(contents, syntax, opts)
|
||||
@@ -1542,7 +1542,7 @@ function M.set_qflist(items)
|
||||
})
|
||||
end
|
||||
|
||||
-- Acording to LSP spec, if the client set "symbolKind.valueSet",
|
||||
-- According to LSP spec, if the client set "symbolKind.valueSet",
|
||||
-- the client must handle it properly even if it receives a value outside the specification.
|
||||
-- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
|
||||
function M._get_symbol_kind_name(symbol_kind)
|
||||
|
||||
@@ -72,7 +72,7 @@ end
|
||||
--- Gets the parser for this bufnr / ft combination.
|
||||
---
|
||||
--- If needed this will create the parser.
|
||||
--- Unconditionnally attach the provided callback
|
||||
--- Unconditionally attach the provided callback
|
||||
---
|
||||
---@param bufnr The buffer the parser should be tied to
|
||||
---@param lang The filetype of this parser
|
||||
|
||||
@@ -38,7 +38,7 @@ end
|
||||
|
||||
--- Inspects the provided language.
|
||||
---
|
||||
--- Inspecting provides some useful informations on the language like node names, ...
|
||||
--- Inspecting provides some useful information on the language like node names, ...
|
||||
---
|
||||
---@param lang The language.
|
||||
function M.inspect_language(lang)
|
||||
|
||||
@@ -493,9 +493,9 @@ local function tree_contains(tree, range)
|
||||
return false
|
||||
end
|
||||
|
||||
--- Determines wether @param range is contained in this language tree
|
||||
--- Determines whether @param range is contained in this language tree
|
||||
---
|
||||
--- This goes down the tree to recursively check childs.
|
||||
--- This goes down the tree to recursively check children.
|
||||
---
|
||||
---@param range A range, that is a `{ start_line, start_col, end_line, end_col }` table.
|
||||
function LanguageTree:contains(range)
|
||||
|
||||
@@ -48,7 +48,7 @@ function M.get_query_files(lang, query_name, is_included)
|
||||
local base_langs = {}
|
||||
|
||||
-- Now get the base languages by looking at the first line of every file
|
||||
-- The syntax is the folowing :
|
||||
-- The syntax is the following :
|
||||
-- ;+ inherits: ({language},)*{language}
|
||||
--
|
||||
-- {language} ::= {lang} | ({lang})
|
||||
@@ -446,7 +446,7 @@ end
|
||||
---
|
||||
--- {source} is needed if the query contains predicates, then the caller
|
||||
--- must ensure to use a freshly parsed tree consistent with the current
|
||||
--- text of the buffer (if relevent). {start_row} and {end_row} can be used to limit
|
||||
--- text of the buffer (if relevant). {start_row} and {end_row} can be used to limit
|
||||
--- matches inside a row range (this is typically used with root node
|
||||
--- as the node, i e to get syntax highlight matches in the current
|
||||
--- viewport). When omitted the start and end row values are used from the given node.
|
||||
@@ -466,7 +466,7 @@ end
|
||||
--- </pre>
|
||||
---
|
||||
---@param node The node under which the search will occur
|
||||
---@param source The source buffer or string to exctract text from
|
||||
---@param source The source buffer or string to extract text from
|
||||
---@param start The starting line of the search
|
||||
---@param stop The stopping line of the search (end-exclusive)
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user