Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
feat: updated docs to 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 10, 2021
1 parent 24d8cf9 commit 6063731
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 103 deletions.
Binary file modified data/api.mpack
Binary file not shown.
Binary file modified data/diagnostic.mpack
Binary file not shown.
Binary file modified data/lsp.mpack
Binary file not shown.
62 changes: 61 additions & 1 deletion types/api.1.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
--# selene: allow(unused_variable)
---@diagnostic disable: unused-local

-- Self-identifies the client.
--- @param name string #Short name for the connected client
--- @param version dictionary #Dictionary describing the version, with
--- these (optional) keys:
--- • "major" major version (defaults to 0 if
--- not set, for no release yet)
--- • "minor" minor version
--- • "patch" patch number
--- • "prerelease" string describing a
--- prerelease, like "dev" or "beta1"
--- • "commit" hash or similar identifier of
--- commit
--- @param type string #Must be one of the following values. Client
--- libraries should default to "remote" unless
--- overridden by the user.
--- • "remote" remote client connected to Nvim.
--- • "ui" gui frontend
--- • "embedder" application using Nvim as a
--- component (for example, IDE/editor
--- implementing a vim mode).
--- • "host" plugin host, typically started by
--- nvim
--- • "plugin" single plugin, started by nvim
--- @param methods dictionary #Builtin methods in the client. For a host,
--- this does not include plugin methods which
--- will be discovered later. The key should be
--- the method name, the values are dicts with
--- these (optional) keys (more keys may be
--- added in future versions of Nvim, thus
--- unknown keys are ignored. Clients must only
--- use keys defined in this or later versions
--- of Nvim):
--- • "async" if true, send as a notification.
--- If false or unspecified, use a blocking
--- request
--- • "nargs" Number of arguments. Could be a
--- single integer or an array of two
--- integers, minimum and maximum inclusive.
--- @param attributes dictionary #Arbitrary string:string map of informal
--- client properties. Suggested keys:
--- • "website": Client homepage URL (e.g.
--- GitHub repository)
--- • "license": License description ("Apache
--- 2", "GPLv3", "MIT", …)
--- • "logo": URI or path to image, preferably
--- small logo or icon. .png or .svg format is
--- preferred.
function vim.api.nvim_set_client_info(name, version, type, methods, attributes) end

-- Sets the current buffer.
--- @param buffer buffer #Buffer handle
function vim.api.nvim_set_current_buf(buffer) end
Expand Down Expand Up @@ -65,11 +114,22 @@ function vim.api.nvim_set_hl(ns_id, name, val) end
--- key is an error.
function vim.api.nvim_set_keymap(mode, lhs, rhs, opts) end

-- Sets an option value.
-- Sets the global value of an option.
--- @param name string #Option name
--- @param value object #New option value
function vim.api.nvim_set_option(name, value) end

-- Sets the value of an option. The behavior of this function
-- matches that of |:set|: for global-local options, both the
-- global and local value are set unless otherwise specified with
-- {scope}.
--- @param name string #Option name
--- @param value object #New option value
--- @param opts dict(option) * #Optional parameters
--- • scope: One of 'global' or 'local'. Analagous to
--- |:setglobal| and |:setlocal|, respectively.
function vim.api.nvim_set_option_value(name, value, opts) end

-- Sets a global (g:) variable.
--- @param name string #Variable name
--- @param value object #Variable value
Expand Down
67 changes: 16 additions & 51 deletions types/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function vim.api.nvim_buf_line_count(buffer) end
--- |api-indexing|
--- @param opts dict(set_extmark) * #Optional parameters.
--- • id : id of the extmark to edit.
---end_line : ending line of the mark, 0-based
---end_row : ending line of the mark, 0-based
--- inclusive.
--- • end_col : ending col of the mark, 0-based
--- exclusive.
Expand Down Expand Up @@ -712,7 +712,7 @@ function vim.api.nvim_get_mode() end
--- @return any #dict that maps from names to namespace ids.
function vim.api.nvim_get_namespaces() end

-- Gets an option value string.
-- Gets the global value of an option.
--- @param name string #Option name
--- @return any #Option value (global)
function vim.api.nvim_get_option(name) end
Expand All @@ -722,6 +722,20 @@ function vim.api.nvim_get_option(name) end
--- @return any #Option Information
function vim.api.nvim_get_option_info(name) end

-- Gets the value of an option. The behavior of this function
-- matches that of |:set|: the local value of an option is
-- returned if it exists; otherwise, the global value is
-- returned. Local values always correspond to the current buffer
-- or window. To get a buffer-local or window-local option for a
-- specific buffer or window, use |nvim_buf_get_option()| or
-- |nvim_win_get_option()|.
--- @param name string #Option name
--- @param opts dict(option) * #Optional parameters
--- • scope: One of 'global' or 'local'. Analagous to
--- |:setglobal| and |:setlocal|, respectively.
--- @return any #Option value
function vim.api.nvim_get_option_value(name, opts) end

-- Gets info describing process `pid` .
--- @param pid integer
--- @return any #Map of process properties, or NIL if process not found.
Expand Down Expand Up @@ -1087,52 +1101,3 @@ function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end
--- @param opts dictionary #Optional parameters. Reserved for future use.
function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end

-- Self-identifies the client.
--- @param name string #Short name for the connected client
--- @param version dictionary #Dictionary describing the version, with
--- these (optional) keys:
--- • "major" major version (defaults to 0 if
--- not set, for no release yet)
--- • "minor" minor version
--- • "patch" patch number
--- • "prerelease" string describing a
--- prerelease, like "dev" or "beta1"
--- • "commit" hash or similar identifier of
--- commit
--- @param type string #Must be one of the following values. Client
--- libraries should default to "remote" unless
--- overridden by the user.
--- • "remote" remote client connected to Nvim.
--- • "ui" gui frontend
--- • "embedder" application using Nvim as a
--- component (for example, IDE/editor
--- implementing a vim mode).
--- • "host" plugin host, typically started by
--- nvim
--- • "plugin" single plugin, started by nvim
--- @param methods dictionary #Builtin methods in the client. For a host,
--- this does not include plugin methods which
--- will be discovered later. The key should be
--- the method name, the values are dicts with
--- these (optional) keys (more keys may be
--- added in future versions of Nvim, thus
--- unknown keys are ignored. Clients must only
--- use keys defined in this or later versions
--- of Nvim):
--- • "async" if true, send as a notification.
--- If false or unspecified, use a blocking
--- request
--- • "nargs" Number of arguments. Could be a
--- single integer or an array of two
--- integers, minimum and maximum inclusive.
--- @param attributes dictionary #Arbitrary string:string map of informal
--- client properties. Suggested keys:
--- • "website": Client homepage URL (e.g.
--- GitHub repository)
--- • "license": License description ("Apache
--- 2", "GPLv3", "MIT", …)
--- • "logo": URI or path to image, preferably
--- small logo or icon. .png or .svg format is
--- preferred.
function vim.api.nvim_set_client_info(name, version, type, methods, attributes) end

105 changes: 54 additions & 51 deletions types/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,59 +181,62 @@ function vim.diagnostic.hide(namespace, bufnr) end
function vim.diagnostic.match(str, pat, groups, severity_map, defaults) end

-- Show diagnostics in a floating window.
--- @param bufnr any #number|nil Buffer number. Defaults to the current
--- buffer.
--- @param opts any #table|nil Configuration table with the same keys
--- as |vim.lsp.util.open_floating_preview()| in
--- addition to the following:
--- • namespace: (number) Limit diagnostics to the
--- given namespace
--- • scope: (string, default "line") Show
--- diagnostics from the whole buffer ("buffer"),
--- the current cursor line ("line"), or the
--- current cursor position ("cursor").
--- • pos: (number or table) If {scope} is "line" or
--- "cursor", use this position rather than the
--- cursor position. If a number, interpreted as a
--- line number; otherwise, a (row, col) tuple.
--- • severity_sort: (default false) Sort diagnostics
--- by severity. Overrides the setting from
--- |vim.diagnostic.config()|.
--- • severity: See |diagnostic-severity|. Overrides
--- the setting from |vim.diagnostic.config()|.
--- • header: (string or table) String to use as the
--- header for the floating window. If a table, it
--- is interpreted as a [text, hl_group] tuple.
--- Overrides the setting from
--- |vim.diagnostic.config()|.
--- • source: (string) Include the diagnostic source
--- in the message. One of "always" or "if_many".
--- Overrides the setting from
--- |vim.diagnostic.config()|.
--- • format: (function) A function that takes a
--- diagnostic as input and returns a string. The
--- return value is the text used to display the
--- diagnostic. Overrides the setting from
--- |vim.diagnostic.config()|.
--- • prefix: (function, string, or table) Prefix
--- each diagnostic in the floating window. If a
--- function, it must have the signature
--- (diagnostic, i, total) -> (string, string),
--- where {i} is the index of the diagnostic being
--- evaluated and {total} is the total number of
--- diagnostics displayed in the window. The
--- function should return a string which is
--- prepended to each diagnostic in the window as
--- well as an (optional) highlight group which
--- will be used to highlight the prefix. If
--- {prefix} is a table, it is interpreted as a
--- [text, hl_group] tuple as in |nvim_echo()|;
--- otherwise, if {prefix} is a string, it is
--- prepended to each diagnostic in the window with
--- no highlight. Overrides the setting from
--- |vim.diagnostic.config()|.
--- as |vim.lsp.util.open_floating_preview()| in
--- addition to the following:
--- • bufnr: (number) Buffer number to show
--- diagnostics from. Defaults to the current
--- buffer.
--- • namespace: (number) Limit diagnostics to the
--- given namespace
--- • scope: (string, default "line") Show diagnostics
--- from the whole buffer ("buffer"), the current
--- cursor line ("line"), or the current cursor
--- position ("cursor"). Shorthand versions are also
--- accepted ("c" for "cursor", "l" for "line", "b"
--- for "buffer").
--- • pos: (number or table) If {scope} is "line" or
--- "cursor", use this position rather than the
--- cursor position. If a number, interpreted as a
--- line number; otherwise, a (row, col) tuple.
--- • severity_sort: (default false) Sort diagnostics
--- by severity. Overrides the setting from
--- |vim.diagnostic.config()|.
--- • severity: See |diagnostic-severity|. Overrides
--- the setting from |vim.diagnostic.config()|.
--- • header: (string or table) String to use as the
--- header for the floating window. If a table, it
--- is interpreted as a [text, hl_group] tuple.
--- Overrides the setting from
--- |vim.diagnostic.config()|.
--- • source: (string) Include the diagnostic source
--- in the message. One of "always" or "if_many".
--- Overrides the setting from
--- |vim.diagnostic.config()|.
--- • format: (function) A function that takes a
--- diagnostic as input and returns a string. The
--- return value is the text used to display the
--- diagnostic. Overrides the setting from
--- |vim.diagnostic.config()|.
--- • prefix: (function, string, or table) Prefix each
--- diagnostic in the floating window. If a
--- function, it must have the signature
--- (diagnostic, i, total) -> (string, string),
--- where {i} is the index of the diagnostic being
--- evaluated and {total} is the total number of
--- diagnostics displayed in the window. The
--- function should return a string which is
--- prepended to each diagnostic in the window as
--- well as an (optional) highlight group which will
--- be used to highlight the prefix. If {prefix} is
--- a table, it is interpreted as a [text, hl_group]
--- tuple as in |nvim_echo()|; otherwise, if
--- {prefix} is a string, it is prepended to each
--- diagnostic in the window with no highlight.
--- Overrides the setting from
--- |vim.diagnostic.config()|.
--- @return any #tuple ({float_bufnr}, {win_id})
function vim.diagnostic.open_float(bufnr, opts) end
function vim.diagnostic.open_float(opts, ...) end

-- Remove all diagnostics from the given namespace.
--- @param namespace any #number|nil Diagnostic namespace. When
Expand Down
3 changes: 3 additions & 0 deletions types/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ function vim.lsp.request(method, params, callback, notify_reply_callback) end

-- Creates a normalized object describing LSP server
-- capabilities.
--- @param server_capabilities any #table Table of capabilities
--- supported by the server
--- @return any #table Normalized table of capabilities
function vim.lsp.resolve_capabilities(server_capabilities) end

-- Run the code lens in the current line
Expand Down

0 comments on commit 6063731

Please sign in to comment.