Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(diagnostic): number → integer #22512

Merged
merged 1 commit into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs(diagnostic): number → integer
  • Loading branch information
tomtomjhj committed Mar 4, 2023
commit 0b85f529da78174ca31f523c20618a8175ff1c87
44 changes: 22 additions & 22 deletions runtime/doc/diagnostic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -423,25 +423,25 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
severities are displayed before lower severities (e.g.
ERROR is displayed before WARN). Options:
• 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.

disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer.

Parameters: ~
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, disable diagnostics in all buffers.
• {namespace} (number|nil) Only disable diagnostics for the given
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
When omitted, disable diagnostics in all buffers.
• {namespace} (integer|nil) Only disable diagnostics for the given
namespace.

enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer.

Parameters: ~
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, enable diagnostics in all buffers.
• {namespace} (number|nil) Only enable diagnostics for the given
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
When omitted, enable diagnostics in all buffers.
• {namespace} (integer|nil) Only enable diagnostics for the given
namespace.

fromqflist({list}) *vim.diagnostic.fromqflist()*
Expand All @@ -458,8 +458,8 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.

Parameters: ~
• {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for
current buffer or nil for all buffers.
• {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0
for current buffer or nil for all buffers.
• {opts} (table|nil) A table with the following keys:
• namespace: (number) Limit diagnostics to the given
namespace.
Expand All @@ -473,7 +473,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.

Parameters: ~
• {namespace} (number) Diagnostic namespace
• {namespace} (integer) Diagnostic namespace

Return: ~
(table) Namespace metadata
Expand Down Expand Up @@ -560,17 +560,17 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|.

Parameters: ~
• {namespace} (number|nil) Diagnostic namespace. When omitted, hide diagnostics from all
• {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all
namespaces.
• {bufnr} (number|nil) Buffer number, or 0 for current buffer. When
omitted, hide diagnostics in all buffers.
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
When omitted, hide diagnostics in all buffers.

is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()*
Check whether diagnostics are disabled in a given buffer.

Parameters: ~
• {bufnr} (number|nil) Buffer number, or 0 for current buffer.
• {namespace} (number|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
• {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
• {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
disabled in {bufnr}. Otherwise, only checks if
diagnostics from {namespace} are disabled.

Expand Down Expand Up @@ -663,7 +663,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
from |vim.diagnostic.config()|.

Return: ~
number|nil, number|nil: ({float_bufnr}, {win_id})
integer|nil, integer|nil: ({float_bufnr}, {win_id})

reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
Remove all diagnostics from the given namespace.
Expand All @@ -674,17 +674,17 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
re-displayed, use |vim.diagnostic.hide()|.

Parameters: ~
• {namespace} (number|nil) Diagnostic namespace. When omitted, remove diagnostics from all
• {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all
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.

set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer.

Parameters: ~
• {namespace} (number) The diagnostic namespace
• {bufnr} (number) Buffer number
• {namespace} (integer) The diagnostic namespace
• {bufnr} (integer) Buffer number
• {diagnostics} (table) A list of diagnostic items
|diagnostic-structure|
• {opts} (table|nil) Display options to pass to
Expand Down Expand Up @@ -723,9 +723,9 @@ show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer.

Parameters: ~
• {namespace} (number|nil) Diagnostic namespace. When omitted, show diagnostics from all
• {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all
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.
• {diagnostics} (table|nil) The diagnostics to display. When omitted,
use the saved diagnostics for the given namespace and
Expand Down
46 changes: 23 additions & 23 deletions runtime/lua/vim/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ end
--- Options:
--- * 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.
function M.config(opts, namespace)
vim.validate({
Expand Down Expand Up @@ -674,8 +674,8 @@ end

--- Set diagnostics for the given namespace and buffer.
---
---@param namespace number The diagnostic namespace
---@param bufnr number Buffer number
---@param namespace integer The diagnostic namespace
---@param bufnr integer Buffer number
---@param diagnostics table A list of diagnostic items |diagnostic-structure|
---@param opts table|nil Display options to pass to |vim.diagnostic.show()|
function M.set(namespace, bufnr, diagnostics, opts)
Expand Down Expand Up @@ -711,7 +711,7 @@ end

--- Get namespace metadata.
---
---@param namespace number Diagnostic namespace
---@param namespace integer Diagnostic namespace
---@return table Namespace metadata
function M.get_namespace(namespace)
vim.validate({ namespace = { namespace, 'n' } })
Expand Down Expand Up @@ -743,11 +743,11 @@ function M.get_namespaces()
end

---@class Diagnostic
---@field buffer number
---@field lnum number 0-indexed
---@field end_lnum nil|number 0-indexed
---@field col number 0-indexed
---@field end_col nil|number 0-indexed
---@field buffer integer
---@field lnum integer 0-indexed
---@field end_lnum nil|integer 0-indexed
---@field col integer 0-indexed
---@field end_col nil|integer 0-indexed
---@field severity DiagnosticSeverity
---@field message string
---@field source nil|string
Expand All @@ -756,7 +756,7 @@ end

--- 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.
---@param opts table|nil A table with the following keys:
--- - namespace: (number) Limit diagnostics to the given namespace.
Expand Down Expand Up @@ -1083,9 +1083,9 @@ end
--- To hide diagnostics and prevent them from re-displaying, use
--- |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.
---@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.
function M.hide(namespace, bufnr)
vim.validate({
Expand All @@ -1108,8 +1108,8 @@ end

--- Check whether diagnostics are disabled in a given buffer.
---
---@param bufnr number|nil Buffer number, or 0 for current buffer.
---@param namespace number|nil Diagnostic namespace. When omitted, checks if
---@param bufnr integer|nil Buffer number, or 0 for current buffer.
---@param namespace integer|nil Diagnostic namespace. When omitted, checks if
--- all diagnostics are disabled in {bufnr}.
--- Otherwise, only checks if diagnostics from
--- {namespace} are disabled.
Expand All @@ -1129,9 +1129,9 @@ end

--- 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.
---@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.
---@param diagnostics table|nil The diagnostics to display. When omitted, use the
--- saved diagnostics for the given namespace and
Expand Down Expand Up @@ -1256,7 +1256,7 @@ end
--- Overrides the setting from |vim.diagnostic.config()|.
--- - suffix: Same as {prefix}, but appends the text to the diagnostic instead of
--- 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, ...)
-- Support old (bufnr, opts) signature
local bufnr
Expand Down Expand Up @@ -1463,9 +1463,9 @@ end
--- simply remove diagnostic decorations in a way that they can be
--- 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.
---@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.
function M.reset(namespace, bufnr)
vim.validate({
Expand Down Expand Up @@ -1518,9 +1518,9 @@ end

--- 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.
---@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)
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
Expand Down Expand Up @@ -1555,9 +1555,9 @@ end

--- 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.
---@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)
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
Expand Down