mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
docs(diagnostic): number → integer (#22512)
This commit is contained in:
parent
65e2feabeb
commit
82b77900d7
@ -423,25 +423,25 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|
|||||||
severities are displayed before lower severities (e.g.
|
severities are displayed before lower severities (e.g.
|
||||||
ERROR is displayed before WARN). Options:
|
ERROR is displayed before WARN). Options:
|
||||||
• reverse: (boolean) Reverse sort order
|
• reverse: (boolean) Reverse sort order
|
||||||
• {namespace} (number|nil) Update the options for the given namespace.
|
• {namespace} (integer|nil) Update the options for the given namespace.
|
||||||
When omitted, update the global diagnostic options.
|
When omitted, update the global diagnostic options.
|
||||||
|
|
||||||
disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
|
disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
|
||||||
Disable diagnostics in the given buffer.
|
Disable diagnostics in the given buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
|
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
|
||||||
omitted, disable diagnostics in all buffers.
|
When omitted, disable diagnostics in all buffers.
|
||||||
• {namespace} (number|nil) Only disable diagnostics for the given
|
• {namespace} (integer|nil) Only disable diagnostics for the given
|
||||||
namespace.
|
namespace.
|
||||||
|
|
||||||
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
|
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
|
||||||
Enable diagnostics in the given buffer.
|
Enable diagnostics in the given buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
|
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
|
||||||
omitted, enable diagnostics in all buffers.
|
When omitted, enable diagnostics in all buffers.
|
||||||
• {namespace} (number|nil) Only enable diagnostics for the given
|
• {namespace} (integer|nil) Only enable diagnostics for the given
|
||||||
namespace.
|
namespace.
|
||||||
|
|
||||||
fromqflist({list}) *vim.diagnostic.fromqflist()*
|
fromqflist({list}) *vim.diagnostic.fromqflist()*
|
||||||
@ -458,8 +458,8 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
|
|||||||
Get current diagnostics.
|
Get current diagnostics.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
|
• {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0
|
||||||
current buffer or nil for all buffers.
|
for current buffer or nil for all buffers.
|
||||||
• {opts} (table|nil) A table with the following keys:
|
• {opts} (table|nil) A table with the following keys:
|
||||||
• namespace: (number) Limit diagnostics to the given
|
• namespace: (number) Limit diagnostics to the given
|
||||||
namespace.
|
namespace.
|
||||||
@ -473,7 +473,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()*
|
|||||||
Get namespace metadata.
|
Get namespace metadata.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {namespace} (number) Diagnostic namespace
|
• {namespace} (integer) Diagnostic namespace
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
(table) Namespace metadata
|
(table) Namespace metadata
|
||||||
@ -560,17 +560,17 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|
|||||||
|vim.diagnostic.disable()|.
|
|vim.diagnostic.disable()|.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {namespace} (number|nil) Diagnostic namespace. When omitted, hide diagnostics from all
|
• {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all
|
||||||
namespaces.
|
namespaces.
|
||||||
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
|
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
|
||||||
omitted, hide diagnostics in all buffers.
|
When omitted, hide diagnostics in all buffers.
|
||||||
|
|
||||||
is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()*
|
is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()*
|
||||||
Check whether diagnostics are disabled in a given buffer.
|
Check whether diagnostics are disabled in a given buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {bufnr} (number|nil) Buffer number, or 0 for current buffer.
|
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
|
||||||
• {namespace} (number|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
|
• {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
|
||||||
disabled in {bufnr}. Otherwise, only checks if
|
disabled in {bufnr}. Otherwise, only checks if
|
||||||
diagnostics from {namespace} are disabled.
|
diagnostics from {namespace} are disabled.
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
|
|||||||
from |vim.diagnostic.config()|.
|
from |vim.diagnostic.config()|.
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
number|nil, number|nil: ({float_bufnr}, {win_id})
|
integer|nil, integer|nil: ({float_bufnr}, {win_id})
|
||||||
|
|
||||||
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
|
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
|
||||||
Remove all diagnostics from the given namespace.
|
Remove all diagnostics from the given namespace.
|
||||||
@ -674,17 +674,17 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
|
|||||||
re-displayed, use |vim.diagnostic.hide()|.
|
re-displayed, use |vim.diagnostic.hide()|.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {namespace} (number|nil) Diagnostic namespace. When omitted, remove diagnostics from all
|
• {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all
|
||||||
namespaces.
|
namespaces.
|
||||||
• {bufnr} (number|nil) Remove diagnostics for the given buffer.
|
• {bufnr} (integer|nil) Remove diagnostics for the given buffer.
|
||||||
When omitted, diagnostics are removed for all buffers.
|
When omitted, diagnostics are removed for all buffers.
|
||||||
|
|
||||||
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
|
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
|
||||||
Set diagnostics for the given namespace and buffer.
|
Set diagnostics for the given namespace and buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {namespace} (number) The diagnostic namespace
|
• {namespace} (integer) The diagnostic namespace
|
||||||
• {bufnr} (number) Buffer number
|
• {bufnr} (integer) Buffer number
|
||||||
• {diagnostics} (table) A list of diagnostic items
|
• {diagnostics} (table) A list of diagnostic items
|
||||||
|diagnostic-structure|
|
|diagnostic-structure|
|
||||||
• {opts} (table|nil) Display options to pass to
|
• {opts} (table|nil) Display options to pass to
|
||||||
@ -723,9 +723,9 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
|
|||||||
Display diagnostics for the given namespace and buffer.
|
Display diagnostics for the given namespace and buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {namespace} (number|nil) Diagnostic namespace. When omitted, show diagnostics from all
|
• {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all
|
||||||
namespaces.
|
namespaces.
|
||||||
• {bufnr} (number|nil) Buffer number, or 0 for current buffer.
|
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
|
||||||
When omitted, show diagnostics in all buffers.
|
When omitted, show diagnostics in all buffers.
|
||||||
• {diagnostics} (table|nil) The diagnostics to display. When omitted,
|
• {diagnostics} (table|nil) The diagnostics to display. When omitted,
|
||||||
use the saved diagnostics for the given namespace and
|
use the saved diagnostics for the given namespace and
|
||||||
|
@ -630,7 +630,7 @@ end
|
|||||||
--- Options:
|
--- Options:
|
||||||
--- * reverse: (boolean) Reverse sort order
|
--- * reverse: (boolean) Reverse sort order
|
||||||
---
|
---
|
||||||
---@param namespace number|nil Update the options for the given namespace. When omitted, update the
|
---@param namespace integer|nil Update the options for the given namespace. When omitted, update the
|
||||||
--- global diagnostic options.
|
--- global diagnostic options.
|
||||||
function M.config(opts, namespace)
|
function M.config(opts, namespace)
|
||||||
vim.validate({
|
vim.validate({
|
||||||
@ -674,8 +674,8 @@ end
|
|||||||
|
|
||||||
--- Set diagnostics for the given namespace and buffer.
|
--- Set diagnostics for the given namespace and buffer.
|
||||||
---
|
---
|
||||||
---@param namespace number The diagnostic namespace
|
---@param namespace integer The diagnostic namespace
|
||||||
---@param bufnr number Buffer number
|
---@param bufnr integer Buffer number
|
||||||
---@param diagnostics table A list of diagnostic items |diagnostic-structure|
|
---@param diagnostics table A list of diagnostic items |diagnostic-structure|
|
||||||
---@param opts table|nil Display options to pass to |vim.diagnostic.show()|
|
---@param opts table|nil Display options to pass to |vim.diagnostic.show()|
|
||||||
function M.set(namespace, bufnr, diagnostics, opts)
|
function M.set(namespace, bufnr, diagnostics, opts)
|
||||||
@ -711,7 +711,7 @@ end
|
|||||||
|
|
||||||
--- Get namespace metadata.
|
--- Get namespace metadata.
|
||||||
---
|
---
|
||||||
---@param namespace number Diagnostic namespace
|
---@param namespace integer Diagnostic namespace
|
||||||
---@return table Namespace metadata
|
---@return table Namespace metadata
|
||||||
function M.get_namespace(namespace)
|
function M.get_namespace(namespace)
|
||||||
vim.validate({ namespace = { namespace, 'n' } })
|
vim.validate({ namespace = { namespace, 'n' } })
|
||||||
@ -743,11 +743,11 @@ function M.get_namespaces()
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@class Diagnostic
|
---@class Diagnostic
|
||||||
---@field buffer number
|
---@field buffer integer
|
||||||
---@field lnum number 0-indexed
|
---@field lnum integer 0-indexed
|
||||||
---@field end_lnum nil|number 0-indexed
|
---@field end_lnum nil|integer 0-indexed
|
||||||
---@field col number 0-indexed
|
---@field col integer 0-indexed
|
||||||
---@field end_col nil|number 0-indexed
|
---@field end_col nil|integer 0-indexed
|
||||||
---@field severity DiagnosticSeverity
|
---@field severity DiagnosticSeverity
|
||||||
---@field message string
|
---@field message string
|
||||||
---@field source nil|string
|
---@field source nil|string
|
||||||
@ -756,7 +756,7 @@ end
|
|||||||
|
|
||||||
--- Get current diagnostics.
|
--- Get current diagnostics.
|
||||||
---
|
---
|
||||||
---@param bufnr number|nil Buffer number to get diagnostics from. Use 0 for
|
---@param bufnr integer|nil Buffer number to get diagnostics from. Use 0 for
|
||||||
--- current buffer or nil for all buffers.
|
--- current buffer or nil for all buffers.
|
||||||
---@param opts table|nil A table with the following keys:
|
---@param opts table|nil A table with the following keys:
|
||||||
--- - namespace: (number) Limit diagnostics to the given namespace.
|
--- - namespace: (number) Limit diagnostics to the given namespace.
|
||||||
@ -1083,9 +1083,9 @@ end
|
|||||||
--- To hide diagnostics and prevent them from re-displaying, use
|
--- To hide diagnostics and prevent them from re-displaying, use
|
||||||
--- |vim.diagnostic.disable()|.
|
--- |vim.diagnostic.disable()|.
|
||||||
---
|
---
|
||||||
---@param namespace number|nil Diagnostic namespace. When omitted, hide
|
---@param namespace integer|nil Diagnostic namespace. When omitted, hide
|
||||||
--- diagnostics from all namespaces.
|
--- diagnostics from all namespaces.
|
||||||
---@param bufnr number|nil Buffer number, or 0 for current buffer. When
|
---@param bufnr integer|nil Buffer number, or 0 for current buffer. When
|
||||||
--- omitted, hide diagnostics in all buffers.
|
--- omitted, hide diagnostics in all buffers.
|
||||||
function M.hide(namespace, bufnr)
|
function M.hide(namespace, bufnr)
|
||||||
vim.validate({
|
vim.validate({
|
||||||
@ -1108,8 +1108,8 @@ end
|
|||||||
|
|
||||||
--- Check whether diagnostics are disabled in a given buffer.
|
--- Check whether diagnostics are disabled in a given buffer.
|
||||||
---
|
---
|
||||||
---@param bufnr number|nil Buffer number, or 0 for current buffer.
|
---@param bufnr integer|nil Buffer number, or 0 for current buffer.
|
||||||
---@param namespace number|nil Diagnostic namespace. When omitted, checks if
|
---@param namespace integer|nil Diagnostic namespace. When omitted, checks if
|
||||||
--- all diagnostics are disabled in {bufnr}.
|
--- all diagnostics are disabled in {bufnr}.
|
||||||
--- Otherwise, only checks if diagnostics from
|
--- Otherwise, only checks if diagnostics from
|
||||||
--- {namespace} are disabled.
|
--- {namespace} are disabled.
|
||||||
@ -1129,9 +1129,9 @@ end
|
|||||||
|
|
||||||
--- Display diagnostics for the given namespace and buffer.
|
--- Display diagnostics for the given namespace and buffer.
|
||||||
---
|
---
|
||||||
---@param namespace number|nil Diagnostic namespace. When omitted, show
|
---@param namespace integer|nil Diagnostic namespace. When omitted, show
|
||||||
--- diagnostics from all namespaces.
|
--- diagnostics from all namespaces.
|
||||||
---@param bufnr number|nil Buffer number, or 0 for current buffer. When omitted, show
|
---@param bufnr integer|nil Buffer number, or 0 for current buffer. When omitted, show
|
||||||
--- diagnostics in all buffers.
|
--- diagnostics in all buffers.
|
||||||
---@param diagnostics table|nil The diagnostics to display. When omitted, use the
|
---@param diagnostics table|nil The diagnostics to display. When omitted, use the
|
||||||
--- saved diagnostics for the given namespace and
|
--- saved diagnostics for the given namespace and
|
||||||
@ -1256,7 +1256,7 @@ end
|
|||||||
--- Overrides the setting from |vim.diagnostic.config()|.
|
--- Overrides the setting from |vim.diagnostic.config()|.
|
||||||
--- - suffix: Same as {prefix}, but appends the text to the diagnostic instead of
|
--- - suffix: Same as {prefix}, but appends the text to the diagnostic instead of
|
||||||
--- prepending it. Overrides the setting from |vim.diagnostic.config()|.
|
--- prepending it. Overrides the setting from |vim.diagnostic.config()|.
|
||||||
---@return number|nil, number|nil: ({float_bufnr}, {win_id})
|
---@return integer|nil, integer|nil: ({float_bufnr}, {win_id})
|
||||||
function M.open_float(opts, ...)
|
function M.open_float(opts, ...)
|
||||||
-- Support old (bufnr, opts) signature
|
-- Support old (bufnr, opts) signature
|
||||||
local bufnr
|
local bufnr
|
||||||
@ -1463,9 +1463,9 @@ end
|
|||||||
--- simply remove diagnostic decorations in a way that they can be
|
--- simply remove diagnostic decorations in a way that they can be
|
||||||
--- re-displayed, use |vim.diagnostic.hide()|.
|
--- re-displayed, use |vim.diagnostic.hide()|.
|
||||||
---
|
---
|
||||||
---@param namespace number|nil Diagnostic namespace. When omitted, remove
|
---@param namespace integer|nil Diagnostic namespace. When omitted, remove
|
||||||
--- diagnostics from all namespaces.
|
--- diagnostics from all namespaces.
|
||||||
---@param bufnr number|nil Remove diagnostics for the given buffer. When omitted,
|
---@param bufnr integer|nil Remove diagnostics for the given buffer. When omitted,
|
||||||
--- diagnostics are removed for all buffers.
|
--- diagnostics are removed for all buffers.
|
||||||
function M.reset(namespace, bufnr)
|
function M.reset(namespace, bufnr)
|
||||||
vim.validate({
|
vim.validate({
|
||||||
@ -1518,9 +1518,9 @@ end
|
|||||||
|
|
||||||
--- Disable diagnostics in the given buffer.
|
--- Disable diagnostics in the given buffer.
|
||||||
---
|
---
|
||||||
---@param bufnr number|nil Buffer number, or 0 for current buffer. When
|
---@param bufnr integer|nil Buffer number, or 0 for current buffer. When
|
||||||
--- omitted, disable diagnostics in all buffers.
|
--- omitted, disable diagnostics in all buffers.
|
||||||
---@param namespace number|nil Only disable diagnostics for the given namespace.
|
---@param namespace integer|nil Only disable diagnostics for the given namespace.
|
||||||
function M.disable(bufnr, namespace)
|
function M.disable(bufnr, namespace)
|
||||||
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
|
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
|
||||||
if bufnr == nil then
|
if bufnr == nil then
|
||||||
@ -1555,9 +1555,9 @@ end
|
|||||||
|
|
||||||
--- Enable diagnostics in the given buffer.
|
--- Enable diagnostics in the given buffer.
|
||||||
---
|
---
|
||||||
---@param bufnr number|nil Buffer number, or 0 for current buffer. When
|
---@param bufnr integer|nil Buffer number, or 0 for current buffer. When
|
||||||
--- omitted, enable diagnostics in all buffers.
|
--- omitted, enable diagnostics in all buffers.
|
||||||
---@param namespace number|nil Only enable diagnostics for the given namespace.
|
---@param namespace integer|nil Only enable diagnostics for the given namespace.
|
||||||
function M.enable(bufnr, namespace)
|
function M.enable(bufnr, namespace)
|
||||||
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
|
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
|
||||||
if bufnr == nil then
|
if bufnr == nil then
|
||||||
|
Loading…
Reference in New Issue
Block a user