Skip to content

Commit 9c3099f

Browse files
justinmkyochem
andcommitted
docs: lsp, misc
- Problem: It's not clear for new plugin developers that `:help` uses a help-tags file for searching the docs, generated by `:helptags`. - Solution: Hint to the |:helptags| docs for regenerating the tags file for their freshly written documentation. Co-authored-by: Yochem van Rosmalen <[email protected]>
1 parent de950f8 commit 9c3099f

25 files changed

+194
-112
lines changed

runtime/doc/api-ui-events.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ message window. Cmdline state is emitted as |ui-cmdline| events, which the UI
826826
must handle.
827827

828828
["msg_show", kind, content, replace_last, history, append, msg_id] ~
829-
Display a message to the user.
829+
Display a message to the user. Update (replace) any existing message
830+
matching `msg_id`.
830831

831832
kind
832833
Name indicating the message kind:

runtime/doc/api.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,9 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
13851385
debugging and orchestration. (Note: Something is better than nothing!
13861386
Fields are optional, but at least set `name`.)
13871387

1388-
Can be called more than once; the caller should merge old info if
1389-
appropriate. Example: library first identifies the channel, then a plugin
1390-
using that library later identifies itself.
1388+
Can be called more than once; caller should merge old info if appropriate.
1389+
Example: a library first identifies the channel, then a plugin using that
1390+
library later identifies itself.
13911391

13921392
Attributes: ~
13931393
|RPC| only
@@ -3324,8 +3324,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
33243324
• on_win: called when starting to redraw a specific window. >
33253325
["win", winid, bufnr, toprow, botrow]
33263326
<
3327-
• on_line: called for each buffer line being redrawn. (The
3328-
interaction with fold lines is subject to change) >
3327+
• on_line: (deprecated, use on_range instead) >
33293328
["line", winid, bufnr, row]
33303329
<
33313330
• on_range: called for each buffer range being redrawn. Range

runtime/doc/change.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,23 +1153,23 @@ first word). You can use the |']| or |`]| command after the put command to
11531153
move the cursor to the end of the inserted text, or use |'[| or |`[| to move
11541154
the cursor to the start.
11551155

1156-
*put-Visual-mode* *v_p* *v_P*
1156+
*put-Visual-mode*
11571157
When using a put command like |p| or |P| in Visual mode, Vim will try to
1158-
replace the selected text with the contents of the register. Whether this
1159-
works well depends on the type of selection and the type of the text in the
1160-
register. With blockwise selection it also depends on the size of the block
1161-
and whether the corners are on an existing character. (Implementation detail:
1162-
it actually works by first putting the register after the selection and then
1163-
deleting the selection.)
1164-
With |p| the previously selected text is put in the unnamed register (and
1165-
possibly the selection and/or clipboard). This is useful if you want to put
1166-
that text somewhere else. But you cannot repeat the same change.
1167-
With |P| the unnamed register is not changed (and neither the selection or
1168-
clipboard), you can repeat the same change. But the deleted text cannot be
1169-
used. If you do need it you can use |p| with another register. E.g., yank
1170-
the text to copy, Visually select the text to replace and use "0p . You can
1171-
repeat this as many times as you like, and the unnamed register will be
1172-
changed each time.
1158+
replace the selected text with the contents of the register. How this
1159+
works depends on the type of selection and the text. With blockwise selection
1160+
it also depends on the size of the block and whether the corners are on an
1161+
existing character. (Implementation detail: it actually works by first
1162+
putting the register after the selection and then deleting the selection.)
1163+
*v_p*
1164+
|p| in Visual mode puts text and sets the default register (unnamed,
1165+
selection, or clipboard) to the previously-selected text. Useful if you want
1166+
to put that text somewhere else. But you cannot repeat the same change.
1167+
*v_P*
1168+
|P| in Visual mode puts text without setting the default register. You can
1169+
repeat the change, but the deleted text cannot be used. If you do need it you
1170+
can use |p| with another register. E.g., yank the text to copy, Visually
1171+
select the text to replace and use "0p . You can repeat this as many times as
1172+
you like, and the unnamed register will be changed each time.
11731173
*blockwise-put*
11741174
When a register contains text from one line (characterwise), using a
11751175
blockwise Visual selection, putting that register will paste that text

runtime/doc/develop.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ Use existing common {verb} names (actions) if possible:
451451
a handler. |dev-name-events|
452452
- open: Opens something (a buffer, window, …)
453453
- parse: Parses something into a structured form
454+
- request: Calls a remote (network, RPC) operation.
455+
- send: Writes data or a message to a channel.
454456
- set: Sets a thing (or group of things)
455457
- start: Spin up a long-lived process. Prefer "enable" except when
456458
"start" is obviously more appropriate.
@@ -461,7 +463,7 @@ Do NOT use these deprecated verbs:
461463
- contains: Prefer "has".
462464
- disable: Prefer `enable(enable: boolean)`.
463465
- exit: Prefer "cancel" (or "stop" if appropriate).
464-
- is_disabled: Prefer `is_enabled()`.
466+
- is_disabled: Prefer `!is_enabled()`.
465467
- list: Redundant with "get"
466468
- notify: Redundant with "print", "echo"
467469
- show: Redundant with "print", "echo"

runtime/doc/insert.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,13 @@ CTRL-R {register} *i_CTRL-R*
104104
Insert the contents of a register. Between typing CTRL-R and
105105
the second character, '"' will be displayed to indicate that
106106
you are expected to enter the name of a register. When used
107-
with When used with named or clipboard registers
108-
(A-Z,a-z,0-9,+) text is inserted literally like pasting with
109-
"p". For other registers, the text is inserted as if you typed
110-
it, but mappings and abbreviations are not used. If you have
111-
options like 'textwidth', 'formatoptions', or 'autoindent'
112-
set, this will influence what will be inserted. This is
113-
different from what happens with the "p" command and pasting
114-
with the mouse.
107+
with named or clipboard registers (A-Z,a-z,0-9,+) text is
108+
inserted literally like pasting with "p". For other registers,
109+
the text is inserted as if you typed it, but mappings and
110+
abbreviations are not used. If you have options like
111+
'textwidth', 'formatoptions', or 'autoindent' set, this will
112+
influence what will be inserted. This is different from what
113+
happens with the "p" command and pasting with the mouse.
115114
Special registers:
116115
'"' the unnamed register, containing the text of
117116
the last delete or yank

runtime/doc/lsp.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,37 @@ is_enabled({filter}) *vim.lsp.inlay_hint.is_enabled()*
22292229
==============================================================================
22302230
Lua module: vim.lsp.inline_completion *lsp-inline_completion*
22312231

2232+
This module provides the LSP "inline completion" feature, for completing
2233+
multiline text (e.g., whole methods) instead of just a word or line, which may
2234+
result in "syntactically or semantically incorrect" code. Unlike regular
2235+
completion, this is typically presented as overlay text instead of a menu of
2236+
completion candidates.
2237+
2238+
LSP spec:
2239+
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_inlineCompletion
2240+
2241+
To try it out, here is a quickstart example using Copilot: *lsp-copilot*
2242+
1. Install Copilot: >sh
2243+
npm install --global @github/copilot-language-server
2244+
<
2245+
2. Define a config, (or copy `lsp/copilot.lua` from
2246+
https://github.com/neovim/nvim-lspconfig): >lua
2247+
vim.lsp.config('copilot', {
2248+
cmd = { 'copilot-language-server', '--stdio', },
2249+
root_markers = { '.git' },
2250+
})
2251+
<
2252+
3. Activate the config: >lua
2253+
vim.lsp.enable('copilot')
2254+
<
2255+
4. Sign in to Copilot, or use the `:LspCopilotSignIn` command from
2256+
https://github.com/neovim/nvim-lspconfig
2257+
5. Enable inline completion: >lua
2258+
vim.lsp.inline_completion.enable()
2259+
<
2260+
6. Set a keymap for `vim.lsp.inline_completion.get()` and invoke the keymap.
2261+
2262+
22322263
*vim.lsp.inline_completion.Item*
22332264

22342265
Fields: ~

runtime/doc/lua-guide.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
==============================================================================
1111
Introduction *lua-guide*
1212

13-
This guide introduces the basics of everyday usage of Lua to configure and
14-
operate Nvim. It assumes some familiarity with the (non-Lua) basics of Nvim
15-
(commands, options, mappings, autocommands), which are covered in the
13+
This guide introduces the basics of everyday Lua usage for configuring and
14+
controlling Nvim. It assumes some familiarity with the (non-Lua) basics of
15+
Nvim (commands, options, mappings, autocommands), which are covered in the
1616
|user-manual|.
1717

1818
This is not a comprehensive encyclopedia of all available features. Think of

runtime/doc/lua-plugin.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
==============================================================================
1111
Introduction *lua-plugin*
1212

13-
This document provides guidance for developing Nvim (Lua) plugins:
13+
This document provides guidance for developing Nvim Lua plugins.
1414

1515
See |lua-guide| for guidance on using Lua to configure and operate Nvim.
1616
See |luaref| and |lua-concepts| for details on the Lua programming language.
@@ -19,7 +19,7 @@ See |luaref| and |lua-concepts| for details on the Lua programming language.
1919
Creating your first plugin *lua-plugin-new*
2020

2121
Any Vimscript or Lua code file that lives in the right directory,
22-
automatically is a "plugin". There's no maniest or "registration" required.
22+
automatically is a "plugin". There's no manifest or "registration" step.
2323

2424
You can try it right now:
2525

@@ -35,7 +35,7 @@ You can try it right now:
3535

3636
Besides `plugin/foo.lua`, which is always run at startup, you can define Lua
3737
modules in the `lua/` directory. Those modules aren't loaded until your
38-
`plugin/foo.lua`, the user, calls `require(…)`.
38+
`plugin/foo.lua`, or the user, calls `require(…)`.
3939

4040
==============================================================================
4141
Type safety *lua-plugin-type-safety*
@@ -108,11 +108,11 @@ In your plugin:
108108
>lua
109109
vim.keymap.set('n', '<Plug>(SayHello)', function()
110110
print('Hello from normal mode')
111-
end, { noremap = true })
111+
end)
112112

113113
vim.keymap.set('v', '<Plug>(SayHello)', function()
114114
print('Hello from visual mode')
115-
end, { noremap = true })
115+
end)
116116
<
117117
In the user's config:
118118
>lua
@@ -176,7 +176,9 @@ For example, instead of:
176176
local foo = require('foo')
177177
vim.api.nvim_create_user_command('MyCommand', function()
178178
foo.do_something()
179-
end, { -- ... })
179+
end, {
180+
-- ...
181+
})
180182
<
181183
which calls `require('foo')` as soon as the module is loaded, you can
182184
lazy-load it by moving the `require` into the command's implementation:
@@ -227,7 +229,7 @@ A plugin tailored to Rust development might have initialization in
227229
-- e.g. add a |<Plug>| mapping or create a command
228230
vim.keymap.set('n', '<Plug>(MyPluginBufferAction)', function()
229231
print('Hello')
230-
end, { noremap = true, buffer = bufnr, })
232+
end, { buffer = bufnr, })
231233
<
232234
==============================================================================
233235
Configuration *lua-plugin-config*
@@ -274,7 +276,7 @@ Versioning and releases *lua-plugin-versioning*
274276
Consider:
275277

276278
- Use |vim.deprecate()| or a `---@deprecate` annotation when you need to
277-
communicate a (future) breaking change or discourged practice.
279+
communicate a (future) breaking change or discouraged practice.
278280
- Using SemVer https://semver.org/ tags and releases to properly communicate
279281
bug fixes, new features, and breaking changes.
280282
- Automating versioning and releases in CI.
@@ -299,7 +301,9 @@ VERSIONING TOOLS
299301
Documentation *lua-plugin-doc*
300302

301303
Provide vimdoc (see |help-writing|), so that users can read your plugin's
302-
documentation in Nvim, by entering `:h {plugin}` in |command-mode|.
304+
documentation in Nvim, by entering `:h {plugin}` in |command-mode|. The
305+
help-tags (the right-aligned "search keywords" in the help documents) are
306+
regenerated using the |:helptags| command.
303307

304308
DOCUMENTATION TOOLS
305309

runtime/doc/message.txt

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -848,25 +848,32 @@ prompt.
848848
==============================================================================
849849
4. PROGRESS MESSAGE *progress-message*
850850

851-
Nvim can emit progress-message, which are a special kind of |ui-messages|
852-
used to report the state of long-running tasks.
851+
Plugins and core Nvim features can emit "progress" |ui-messages| to report the
852+
state of long-running tasks.
853853

854-
Progress messages are created or updated using |nvim_echo()| with `kind='progress'`
855-
and the related options. Each message has a unique `msg_id`. A subsequent
856-
message with the same `msg_id` replaces the older one.
854+
Create or update a progress-message by calling |nvim_echo()| with
855+
`kind='progress'`. Each message has a unique message-id, returned by
856+
`nvim_echo`. You can specify the id when calling `nvim_echo` to update an
857+
existing progress-message.
857858

858859
Events: ~
859860
• msg_show |ui-messages| event is fired for ext-ui upon creation/update of a
860861
progress-message
861862
• Updating or creating a progress message also triggers the |Progress| autocommand.
862863

863-
Example: >
864-
local id = vim.api.nvim_echo({{'searching...'}}, true,
865-
{kind='progress', status='running', percent=10, title="term"})
866-
vim.api.nvim_echo({{'searching'}}, true,
867-
{id=id, kind='progress', status='running', percent=50, title="term"})
868-
vim.api.nvim_echo({{'done'}}, true,
869-
{id=id, kind='progress', status='success', percent=100, title="term"})
864+
Example: >lua
865+
local progress = {
866+
kind = 'progress',
867+
status = 'running',
868+
percent = 10,
869+
title = 'term',
870+
}
871+
progress.id = vim.api.nvim_echo({ { 'searching...' } }, true, progress)
872+
progress.percent = 50
873+
vim.api.nvim_echo({ { 'searching' } }, true, progress)
874+
progress.status = 'success'
875+
progress.percent = 100
876+
vim.api.nvim_echo({ { 'done' } }, true, progress)
870877
<
871878
See also: |nvim_echo()| |ui-messages| |Progress|
872879

runtime/doc/news.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ DIAGNOSTICS
6868

6969
EDITOR
7070

71-
|i_CTRL-R| inserts named registers (A-Z,a-z,0-9) literally like pasting instead of
72-
as typed. To get the old behavior you can use `<C-R>=@x`.
71+
- |i_CTRL-R| inserts named/clipboard registers (A-Z,a-z,0-9+) literally, like
72+
pasting instead of like user input. Improves performance, avoids broken
73+
formatting. To get the old behavior you can use `<C-R>=@x`.
7374

7475
EVENTS
7576

@@ -203,9 +204,8 @@ EVENTS
203204
HIGHLIGHTS
204205

205206
|hl-DiffTextAdd| highlights added text within a changed line.
206-
|hl-StderrMsg| |hl-StdoutMsg|
207+
|hl-OkMsg| |hl-StderrMsg| |hl-StdoutMsg|
207208
|hl-SnippetTabstopActive| highlights the currently active tabstop.
208-
|hl-OkMsg| highlights success messages.
209209

210210
LSP
211211

@@ -244,6 +244,7 @@ LSP
244244
|vim.lsp.buf.signature_help()| supports "noActiveParameterSupport".
245245
• Support for `textDocument/inlineCompletion` |lsp-inline_completion|
246246
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_inlineCompletion
247+
See |lsp-inline_completion| for quickstart instructions.
247248
• Support for `textDocument/onTypeFormatting`: |lsp-on_type_formatting|
248249
https://microsoft.github.io/language-server-protocol/specification/#textDocument_onTypeFormatting
249250

@@ -291,6 +292,7 @@ PERFORMANCE
291292
support for nested braces and follows LSP 3.17 specification with
292293
additional constraints for improved correctness and resistance to
293294
backtracking edge cases.
295+
- |i_CTRL-R| inserts named/clipboard registers literally, 10x speedup.
294296

295297
PLUGINS
296298

0 commit comments

Comments
 (0)