aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-05-28 08:51:44 -0500
committerGitHub <noreply@github.com>2024-05-28 08:51:44 -0500
commit8ba73f0e4cc6c82032a348a1d6c8d794ed150fd7 (patch)
tree3b20d70fa619488d497fe34e6f398fe481977226 /runtime/doc
parent90a4b1a59cf0c204cb39ec7789ab8783626e449d (diff)
downloadrneovim-8ba73f0e4cc6c82032a348a1d6c8d794ed150fd7.tar.gz
rneovim-8ba73f0e4cc6c82032a348a1d6c8d794ed150fd7.tar.bz2
rneovim-8ba73f0e4cc6c82032a348a1d6c8d794ed150fd7.zip
feat(diagnostic): add vim.diagnostic.jump() (#26745)
Deprecate vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() in favor of a unified vim.diagnostic.jump() interface. We cannot name the function "goto()" because some of our tooling (luacheck and stylua) fail to parse it, presumably because "goto" is a keyword in newer versions of Lua. vim.diagnostic.jump() also allows moving to a specific diagnostic and moving by multiple diagnostics at a time (useful for creating mappings that use v:count).
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/deprecated.txt17
-rw-r--r--runtime/doc/diagnostic.txt91
2 files changed, 53 insertions, 55 deletions
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index be220fc307..6c6585d76e 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -22,6 +22,20 @@ API
LUA
- vim.region() Use |getregionpos()| instead.
+DIAGNOSTICS
+- *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count = 1}` instead.
+- *vim.diagnostic.goto_prev()* Use |vim.diagnostic.jump()| with `{count = -1}` instead.
+- *vim.diagnostic.get_next_pos()*
+ Use the "lnum" and "col" fields from the return value of
+ |vim.diagnostic.get_next()| instead.
+- *vim.diagnostic.get_prev_pos()*
+ Use the "lnum" and "col" fields from the return value of
+ |vim.diagnostic.get_prev()| instead.
+- The "win_id" parameter used by various functions is deprecated in favor of
+ "winid" |winid|
+- The "cursor_position" parameter of |vim.diagnostic.JumpOpts| is renamed to
+ "pos"
+
------------------------------------------------------------------------------
DEPRECATED IN 0.10 *deprecated-0.10*
@@ -204,9 +218,6 @@ internally and are no longer exposed as part of the API. Instead, use
- *vim.lsp.diagnostic.set_underline()*
- *vim.lsp.diagnostic.set_virtual_text()*
-Configuring |diagnostic-signs| with |:sign-define| or |sign_define()| is no
-longer supported. Use the "signs" key of |vim.diagnostic.config()| instead.
-
LSP FUNCTIONS
- *vim.lsp.buf.server_ready()*
Use |LspAttach| instead, depending on your use-case. "Server ready" is not
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 36616b9a0d..be9e54d6cd 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -378,28 +378,37 @@ Lua module: vim.diagnostic *diagnostic-api*
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
-*vim.diagnostic.GotoOpts*
+*vim.diagnostic.JumpOpts*
Extends: |vim.diagnostic.GetOpts|
Configuration table with the following keys:
Fields: ~
- • {cursor_position}? (`{[1]:integer,[2]:integer}`, default: current cursor position)
- Cursor position as a `(row, col)` tuple. See
- |nvim_win_get_cursor()|.
- • {wrap}? (`boolean`, default: `true`) Whether to loop
- around file or not. Similar to 'wrapscan'.
- • {severity}? (`vim.diagnostic.SeverityFilter`) See
- |diagnostic-severity|.
- • {float}? (`boolean|vim.diagnostic.Opts.Float`, 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()|. Unless overridden,
- the float will show diagnostics at the new cursor
- position (as if "cursor" were passed to the
- "scope" option).
- • {win_id}? (`integer`, default: `0`) Window ID
+ • {diagnostic}? (`vim.Diagnostic`) The diagnostic to jump to. Mutually
+ exclusive with {count}, {namespace}, and {severity}.
+ See |vim.Diagnostic|.
+ • {count}? (`integer`) The number of diagnostics to move by,
+ starting from {pos}. A positive integer moves forward
+ by {count} diagnostics, while a negative integer moves
+ backward by {count} diagnostics. Mutually exclusive
+ with {diagnostic}.
+ • {pos}? (`{[1]:integer,[2]:integer}`) Cursor position as a
+ `(row, col)` tuple. See |nvim_win_get_cursor()|. Used
+ to find the nearest diagnostic when {count} is used.
+ Only used when {count} is non-nil. Default is the
+ current cursor position.
+ • {wrap}? (`boolean`, default: `true`) Whether to loop around
+ file or not. Similar to 'wrapscan'.
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
+ |diagnostic-severity|.
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, 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()|. Unless
+ overridden, the float will show diagnostics at the new
+ cursor position (as if "cursor" were passed to the
+ "scope" option).
+ • {winid}? (`integer`, default: `0`) Window ID
*vim.diagnostic.NS*
@@ -678,52 +687,20 @@ get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position.
Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
+ • {opts} (`vim.diagnostic.JumpOpts?`) See |vim.diagnostic.JumpOpts|.
Return: ~
(`vim.Diagnostic?`) Next diagnostic. See |vim.Diagnostic|.
-get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
- Return the position of the next diagnostic in the current buffer.
-
- Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
- Return: ~
- (`table|false`) Next diagnostic position as a `(row, col)` tuple or
- false if no next diagnostic.
-
get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position.
Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
+ • {opts} (`vim.diagnostic.JumpOpts?`) See |vim.diagnostic.JumpOpts|.
Return: ~
(`vim.Diagnostic?`) Previous diagnostic. See |vim.Diagnostic|.
-get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
- Return the position of the previous diagnostic in the current buffer.
-
- Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
- Return: ~
- (`table|false`) Previous diagnostic position as a `(row, col)` tuple
- or `false` if there is no prior diagnostic.
-
-goto_next({opts}) *vim.diagnostic.goto_next()*
- Move to the next diagnostic.
-
- Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
-goto_prev({opts}) *vim.diagnostic.goto_prev()*
- Move to the previous diagnostic in the current buffer.
-
- Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics.
@@ -753,6 +730,16 @@ is_enabled({filter}) *vim.diagnostic.is_enabled()*
Return: ~
(`boolean`)
+jump({opts}) *vim.diagnostic.jump()*
+ Move to a diagnostic.
+
+ Parameters: ~
+ • {opts} (`vim.diagnostic.JumpOpts`) See |vim.diagnostic.JumpOpts|.
+
+ Return: ~
+ (`vim.Diagnostic?`) The diagnostic that was moved to. See
+ |vim.Diagnostic|.
+
*vim.diagnostic.match()*
match({str}, {pat}, {groups}, {severity_map}, {defaults})
Parse a diagnostic from a string.
@@ -792,7 +779,7 @@ open_float({opts}) *vim.diagnostic.open_float()*
Return (multiple): ~
(`integer?`) float_bufnr
- (`integer?`) win_id
+ (`integer?`) winid
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
Remove all diagnostics from the given namespace.