mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 09:02:40 +00:00
docs: various #25289
Co-authored-by: Jongwook Choi <wookayin@gmail.com> Co-authored-by: Oliver Marriott <hello@omarriott.com> Co-authored-by: Benoit de Chezelles <bew@users.noreply.github.com> Co-authored-by: Jongwook Choi <wookayin@gmail.com>
This commit is contained in:
@@ -149,8 +149,10 @@ View the [Clang report] to see potential bugs found by the Clang
|
|||||||
|
|
||||||
### Coverity
|
### Coverity
|
||||||
|
|
||||||
[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the
|
Coverity runs against the master build. To view the defects you must
|
||||||
master build. To view the defects, just request access; you will be approved.
|
[request access](https://scan.coverity.com/projects/neovim-neovim) (Coverity
|
||||||
|
does not have a "public" view), then you will be approved as soon as
|
||||||
|
a maintainer sees the email.
|
||||||
|
|
||||||
- Use this format for commit messages (where `{id}` is the CID (Coverity ID);
|
- Use this format for commit messages (where `{id}` is the CID (Coverity ID);
|
||||||
([example](https://github.com/neovim/neovim/pull/804))):
|
([example](https://github.com/neovim/neovim/pull/804))):
|
||||||
@@ -283,7 +285,7 @@ If you need to modify or debug the documentation flow, these are the main files:
|
|||||||
### Lua docstrings
|
### Lua docstrings
|
||||||
|
|
||||||
Use [LuaLS] annotations in Lua docstrings to annotate parameter types, return
|
Use [LuaLS] annotations in Lua docstrings to annotate parameter types, return
|
||||||
types, etc. See [:help dev-doc-lua][dev-doc-lua].
|
types, etc. See [:help dev-lua-doc][dev-lua-doc].
|
||||||
|
|
||||||
- The template for function documentation is:
|
- The template for function documentation is:
|
||||||
```lua
|
```lua
|
||||||
@@ -331,8 +333,8 @@ as context, use the `-W` argument as well.
|
|||||||
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
|
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
|
||||||
[conventional_commits]: https://www.conventionalcommits.org
|
[conventional_commits]: https://www.conventionalcommits.org
|
||||||
[dev-doc-guide]: https://neovim.io/doc/user/develop.html#dev-doc
|
[dev-doc-guide]: https://neovim.io/doc/user/develop.html#dev-doc
|
||||||
[dev-doc-lua]: https://neovim.io/doc/user/develop.html#dev-lua-doc
|
[dev-lua-doc]: https://neovim.io/doc/user/develop.html#dev-lua-doc
|
||||||
[LuaLS]: https://github.com/LuaLS/lua-language-server/wiki/Annotations
|
[LuaLS]: https://luals.github.io/wiki/annotations/
|
||||||
[gcc-warnings]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
[gcc-warnings]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||||
[gh]: https://cli.github.com/
|
[gh]: https://cli.github.com/
|
||||||
[git-bisect]: http://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git
|
[git-bisect]: http://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ option(USE_BUNDLED "Use bundled dependencies." ON)
|
|||||||
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
|
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
|
||||||
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
||||||
option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED})
|
option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED})
|
||||||
|
# PUC Lua is only used for tests, unless explicitly requested.
|
||||||
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
|
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
|
||||||
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
|
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
|
||||||
option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
|
option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
|
||||||
|
|||||||
@@ -784,9 +784,6 @@ OptionSet After setting an option (except during
|
|||||||
are not global-local it is the old local
|
are not global-local it is the old local
|
||||||
value.
|
value.
|
||||||
|
|
||||||
OptionSet is not triggered on startup and for
|
|
||||||
the 'key' option for obvious reasons.
|
|
||||||
|
|
||||||
Usage example: Check for the existence of the
|
Usage example: Check for the existence of the
|
||||||
directory in the 'backupdir' and 'undodir'
|
directory in the 'backupdir' and 'undodir'
|
||||||
options, create the directory if it doesn't
|
options, create the directory if it doesn't
|
||||||
@@ -800,6 +797,8 @@ OptionSet After setting an option (except during
|
|||||||
Non-recursive: |:set| in the autocommand does
|
Non-recursive: |:set| in the autocommand does
|
||||||
not trigger OptionSet again.
|
not trigger OptionSet again.
|
||||||
|
|
||||||
|
Not triggered on startup.
|
||||||
|
|
||||||
*QuickFixCmdPre*
|
*QuickFixCmdPre*
|
||||||
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
||||||
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|
||||||
|
|||||||
@@ -911,9 +911,8 @@ start({config}, {opts}) *vim.lsp.start()*
|
|||||||
|
|
||||||
• `name` arbitrary name for the LSP client. Should be unique per language
|
• `name` arbitrary name for the LSP client. Should be unique per language
|
||||||
server.
|
server.
|
||||||
• `cmd` command (in list form) used to start the language server. Must be
|
• `cmd` command string[] or function, described at
|
||||||
absolute, or found on `$PATH`. Shell constructs like `~` are not
|
|vim.lsp.start_client()|.
|
||||||
expanded.
|
|
||||||
• `root_dir` path to the project root. By default this is used to decide
|
• `root_dir` path to the project root. By default this is used to decide
|
||||||
if an existing client should be re-used. The example above uses
|
if an existing client should be re-used. The example above uses
|
||||||
|vim.fs.find()| and |vim.fs.dirname()| to detect the root by traversing
|
|vim.fs.find()| and |vim.fs.dirname()| to detect the root by traversing
|
||||||
@@ -953,15 +952,16 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {config} (`lsp.ClientConfig`) Configuration for the server:
|
• {config} (`lsp.ClientConfig`) Configuration for the server:
|
||||||
• cmd: (string[]|fun(dispatchers: table):table) command a
|
• cmd: (string[]|fun(dispatchers: table):table) command
|
||||||
list of strings treated like |jobstart()|. The command
|
string[] that launches the language server (treated as in
|
||||||
must launch the language server process. `cmd` can also be
|
|jobstart()|, must be absolute or on `$PATH`, shell
|
||||||
a function that creates an RPC client. The function
|
constructs like "~" are not expanded), or function that
|
||||||
receives a dispatchers table and must return a table with
|
creates an RPC client. Function receives a `dispatchers`
|
||||||
the functions `request`, `notify`, `is_closing` and
|
table and returns a table with member functions `request`,
|
||||||
`terminate` See |vim.lsp.rpc.request()| and
|
`notify`, `is_closing` and `terminate`. See
|
||||||
|vim.lsp.rpc.notify()| For TCP there is a built-in rpc
|
|vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|. For TCP
|
||||||
client factory: |vim.lsp.rpc.connect()|
|
there is a builtin RPC client factory:
|
||||||
|
|vim.lsp.rpc.connect()|
|
||||||
• cmd_cwd: (string, default=|getcwd()|) Directory to launch
|
• cmd_cwd: (string, default=|getcwd()|) Directory to launch
|
||||||
the `cmd` process. Not related to `root_dir`.
|
the `cmd` process. Not related to `root_dir`.
|
||||||
• cmd_env: (table) Environment flags to pass to the LSP on
|
• cmd_env: (table) Environment flags to pass to the LSP on
|
||||||
@@ -1479,7 +1479,11 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
|
|||||||
Lua module: vim.lsp.inlay_hint *lsp-inlay_hint*
|
Lua module: vim.lsp.inlay_hint *lsp-inlay_hint*
|
||||||
|
|
||||||
enable({bufnr}, {enable}) *vim.lsp.inlay_hint.enable()*
|
enable({bufnr}, {enable}) *vim.lsp.inlay_hint.enable()*
|
||||||
Enable/disable/toggle inlay hints for a buffer
|
Enables or disables inlay hints for a buffer.
|
||||||
|
|
||||||
|
To "toggle", pass the inverse of `is_enabled()`: >lua
|
||||||
|
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
|
||||||
|
<
|
||||||
|
|
||||||
Note: ~
|
Note: ~
|
||||||
This API is pre-release (unstable).
|
This API is pre-release (unstable).
|
||||||
|
|||||||
@@ -1048,7 +1048,7 @@ CTRL-I Go to [count] newer cursor position in jump list
|
|||||||
|tui-modifyOtherKeys| or |tui-csiu|, CTRL-I can be
|
|tui-modifyOtherKeys| or |tui-csiu|, CTRL-I can be
|
||||||
mapped separately from <Tab>, on the condition that
|
mapped separately from <Tab>, on the condition that
|
||||||
both keys are mapped, otherwise the mapping applies to
|
both keys are mapped, otherwise the mapping applies to
|
||||||
both.
|
both. Except in tmux: https://github.com/tmux/tmux/issues/2705
|
||||||
|
|
||||||
*:ju* *:jumps*
|
*:ju* *:jumps*
|
||||||
:ju[mps] Print the jump list (not a motion command).
|
:ju[mps] Print the jump list (not a motion command).
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ You can find this in the user manual, section |11.3|.
|
|||||||
|
|
||||||
*W325*
|
*W325*
|
||||||
The default |SwapExists| handler (|default-autocmds|) skips the |E325| prompt
|
The default |SwapExists| handler (|default-autocmds|) skips the |E325| prompt
|
||||||
(selects "(E)dit") if the swapfile owner process (1) is still running and (2)
|
(and automatically chooses "(E)dit") if the swapfile owner process is still
|
||||||
was started by the current user. This presumes that you normally don't want
|
running and owned by the current user. This presumes that you normally don't
|
||||||
to be bothered with the |ATTENTION| message just because you happen to edit
|
want to be bothered with the |ATTENTION| message just because you happen to
|
||||||
the same file from multiple Nvim instances. In the worst case (a system
|
edit the same file from multiple Nvim instances. In the worst case (a system
|
||||||
crash) there will be more than one swapfile for the file; use |:recover| to
|
crash) there will be more than one swapfile for the file; use |:recover| to
|
||||||
inspect all of its swapfiles.
|
inspect all of its swapfiles.
|
||||||
|
|
||||||
|
|||||||
@@ -488,8 +488,7 @@ end
|
|||||||
--- See |vim.lsp.start_client()| for all available options. The most important are:
|
--- See |vim.lsp.start_client()| for all available options. The most important are:
|
||||||
---
|
---
|
||||||
--- - `name` arbitrary name for the LSP client. Should be unique per language server.
|
--- - `name` arbitrary name for the LSP client. Should be unique per language server.
|
||||||
--- - `cmd` command (in list form) used to start the language server. Must be absolute, or found on
|
--- - `cmd` command string[] or function, described at |vim.lsp.start_client()|.
|
||||||
--- `$PATH`. Shell constructs like `~` are not expanded.
|
|
||||||
--- - `root_dir` path to the project root. By default this is used to decide if an existing client
|
--- - `root_dir` path to the project root. By default this is used to decide if an existing client
|
||||||
--- should be re-used. The example above uses |vim.fs.find()| and |vim.fs.dirname()| to detect the
|
--- should be re-used. The example above uses |vim.fs.find()| and |vim.fs.dirname()| to detect the
|
||||||
--- root by traversing the file system upwards starting from the current directory until either
|
--- root by traversing the file system upwards starting from the current directory until either
|
||||||
@@ -666,13 +665,13 @@ end
|
|||||||
--- Field `cmd` in {config} is required.
|
--- Field `cmd` in {config} is required.
|
||||||
---
|
---
|
||||||
---@param config (lsp.ClientConfig) Configuration for the server:
|
---@param config (lsp.ClientConfig) Configuration for the server:
|
||||||
--- - cmd: (string[]|fun(dispatchers: table):table) command a list of
|
--- - cmd: (string[]|fun(dispatchers: table):table) command string[] that launches the language
|
||||||
--- strings treated like |jobstart()|. The command must launch the language server
|
--- server (treated as in |jobstart()|, must be absolute or on `$PATH`, shell constructs like
|
||||||
--- process. `cmd` can also be a function that creates an RPC client.
|
--- "~" are not expanded), or function that creates an RPC client. Function receives
|
||||||
--- The function receives a dispatchers table and must return a table with the
|
--- a `dispatchers` table and returns a table with member functions `request`, `notify`,
|
||||||
--- functions `request`, `notify`, `is_closing` and `terminate`
|
--- `is_closing` and `terminate`.
|
||||||
--- See |vim.lsp.rpc.request()| and |vim.lsp.rpc.notify()|
|
--- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|.
|
||||||
--- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect()|
|
--- For TCP there is a builtin RPC client factory: |vim.lsp.rpc.connect()|
|
||||||
---
|
---
|
||||||
--- - cmd_cwd: (string, default=|getcwd()|) Directory to launch
|
--- - cmd_cwd: (string, default=|getcwd()|) Directory to launch
|
||||||
--- the `cmd` process. Not related to `root_dir`.
|
--- the `cmd` process. Not related to `root_dir`.
|
||||||
|
|||||||
@@ -368,7 +368,13 @@ function M.is_enabled(bufnr)
|
|||||||
return bufstates[bufnr] and bufstates[bufnr].enabled or false
|
return bufstates[bufnr] and bufstates[bufnr].enabled or false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Enable/disable/toggle inlay hints for a buffer
|
--- Enables or disables inlay hints for a buffer.
|
||||||
|
---
|
||||||
|
--- To "toggle", pass the inverse of `is_enabled()`:
|
||||||
|
---
|
||||||
|
--- ```lua
|
||||||
|
--- vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
|
||||||
|
--- ```
|
||||||
---
|
---
|
||||||
--- @param bufnr (integer|nil) Buffer handle, or 0 or nil for current
|
--- @param bufnr (integer|nil) Buffer handle, or 0 or nil for current
|
||||||
--- @param enable (boolean|nil) true/nil to enable, false to disable
|
--- @param enable (boolean|nil) true/nil to enable, false to disable
|
||||||
|
|||||||
@@ -255,6 +255,12 @@ region is repainted internally. To also highlight excess internal redraws, use
|
|||||||
- http://bazaar.launchpad.net/~libvterm/libvterm/trunk/view/head:/doc/seqs.txt
|
- http://bazaar.launchpad.net/~libvterm/libvterm/trunk/view/head:/doc/seqs.txt
|
||||||
- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
|
||||||
|
|
||||||
|
Data structures
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Buffer text is stored as a tree of line segments, defined in [memline.c](https://github.com/neovim/neovim/blob/v0.9.5/src/nvim/memline.c#L8-L35).
|
||||||
|
The central idea is found in [ml_find_line](https://github.com/neovim/neovim/blob/v0.9.5/src/nvim/memline.c#L2800).
|
||||||
|
|
||||||
Nvim lifecycle
|
Nvim lifecycle
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|||||||
@@ -1312,6 +1312,9 @@ void tui_default_colors_set(TUIData *tui, Integer rgb_fg, Integer rgb_bg, Intege
|
|||||||
invalidate(tui, 0, tui->grid.height, 0, tui->grid.width);
|
invalidate(tui, 0, tui->grid.height, 0, tui->grid.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Flushes TUI grid state to a buffer (which is later flushed to the TTY by `flush_buf`).
|
||||||
|
///
|
||||||
|
/// @see flush_buf
|
||||||
void tui_flush(TUIData *tui)
|
void tui_flush(TUIData *tui)
|
||||||
{
|
{
|
||||||
UGrid *grid = &tui->grid;
|
UGrid *grid = &tui->grid;
|
||||||
@@ -2327,6 +2330,9 @@ static size_t flush_buf_end(TUIData *tui, char *buf, size_t len)
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Flushes the rendered buffer to the TTY.
|
||||||
|
///
|
||||||
|
/// @see tui_flush
|
||||||
static void flush_buf(TUIData *tui)
|
static void flush_buf(TUIData *tui)
|
||||||
{
|
{
|
||||||
uv_write_t req;
|
uv_write_t req;
|
||||||
|
|||||||
@@ -99,7 +99,10 @@ describe('vim._watch', function()
|
|||||||
|
|
||||||
describe('poll', function()
|
describe('poll', function()
|
||||||
it('detects file changes', function()
|
it('detects file changes', function()
|
||||||
skip(is_os('bsd'), 'bsd only reports rename on folders if file inside change')
|
skip(
|
||||||
|
is_os('bsd'),
|
||||||
|
'kqueue only reports events on watched folder itself, not contained files #26110'
|
||||||
|
)
|
||||||
local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX')
|
local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(helpers.tmpname()) .. '/nvim_XXXXXXXXXX')
|
||||||
|
|
||||||
local result = exec_lua(
|
local result = exec_lua(
|
||||||
|
|||||||
@@ -4261,7 +4261,10 @@ describe('LSP', function()
|
|||||||
|
|
||||||
describe('vim.lsp._watchfiles', function()
|
describe('vim.lsp._watchfiles', function()
|
||||||
it('sends notifications when files change', function()
|
it('sends notifications when files change', function()
|
||||||
skip(is_os('bsd'), 'bsd only reports rename on folders if file inside change')
|
skip(
|
||||||
|
is_os('bsd'),
|
||||||
|
'kqueue only reports events on watched folder itself, not contained files #26110'
|
||||||
|
)
|
||||||
local root_dir = tmpname()
|
local root_dir = tmpname()
|
||||||
os.remove(root_dir)
|
os.remove(root_dir)
|
||||||
mkdir(root_dir)
|
mkdir(root_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user