mirror of
https://github.com/neovim/neovim.git
synced 2025-12-19 12:55:32 +00:00
lsp: validate and document server settings (#13698)
* update lua documentation * run docgen
This commit is contained in:
committed by
GitHub
parent
3f63100d5b
commit
f9b3110549
@@ -639,8 +639,9 @@ client() *vim.lsp.client*
|
|||||||
automatically escalate and force shutdown.
|
automatically escalate and force shutdown.
|
||||||
• is_stopped() Checks whether a client is stopped. Returns:
|
• is_stopped() Checks whether a client is stopped. Returns:
|
||||||
true if the client is fully stopped.
|
true if the client is fully stopped.
|
||||||
• on_attach(client, bufnr) Runs the on_attach function from the
|
• on_attach(client, bufnr) Runs the on_attach function from
|
||||||
client's config if it was defined. Useful for buffer-local setup.
|
the client's config if it was defined. Useful for
|
||||||
|
buffer-local setup.
|
||||||
|
|
||||||
• Members
|
• Members
|
||||||
• {id} (number): The id allocated to the client.
|
• {id} (number): The id allocated to the client.
|
||||||
@@ -776,8 +777,9 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
{handlers} Map of language server method names to
|
{handlers} Map of language server method names to
|
||||||
|lsp-handler|
|
|lsp-handler|
|
||||||
{settings} Map with language server specific
|
{settings} Map with language server specific
|
||||||
settings. These are returned to the language server if
|
settings. These are returned to the
|
||||||
requested via `workspace/configuration`. Keys are
|
language server if requested via
|
||||||
|
`workspace/configuration` . Keys are
|
||||||
case-sensitive.
|
case-sensitive.
|
||||||
{init_options} Values to pass in the initialization
|
{init_options} Values to pass in the initialization
|
||||||
request as `initializationOptions` .
|
request as `initializationOptions` .
|
||||||
@@ -815,7 +817,14 @@ start_client({config}) *vim.lsp.start_client()*
|
|||||||
`capabilities.offsetEncoding` was sent
|
`capabilities.offsetEncoding` was sent
|
||||||
to it. You can only modify the
|
to it. You can only modify the
|
||||||
`client.offset_encoding` here before
|
`client.offset_encoding` here before
|
||||||
any notifications are sent.
|
any notifications are sent. Most
|
||||||
|
language servers expect to be sent
|
||||||
|
client specified settings after
|
||||||
|
initialization. Neovim does not make
|
||||||
|
this assumption. A
|
||||||
|
`workspace/didChangeConfiguration`
|
||||||
|
notification should be sent to the
|
||||||
|
server during on_init.
|
||||||
{on_exit} Callback (code, signal, client_id)
|
{on_exit} Callback (code, signal, client_id)
|
||||||
invoked on client exit.
|
invoked on client exit.
|
||||||
• code: exit code of the process
|
• code: exit code of the process
|
||||||
@@ -1342,6 +1351,10 @@ set_signs({diagnostics}, {bufnr}, {client_id}, {sign_ns}, {opts})
|
|||||||
{sign_ns} number|nil
|
{sign_ns} number|nil
|
||||||
{opts} table Configuration for signs. Keys:
|
{opts} table Configuration for signs. Keys:
|
||||||
• priority: Set the priority of the signs.
|
• priority: Set the priority of the signs.
|
||||||
|
• severity_limit (DiagnosticSeverity):
|
||||||
|
• Limit severity of diagnostics found.
|
||||||
|
E.g. "Warning" means { "Error",
|
||||||
|
"Warning" } will be valid.
|
||||||
|
|
||||||
*vim.lsp.diagnostic.set_underline()*
|
*vim.lsp.diagnostic.set_underline()*
|
||||||
set_underline({diagnostics}, {bufnr}, {client_id}, {diagnostic_ns}, {opts})
|
set_underline({diagnostics}, {bufnr}, {client_id}, {diagnostic_ns}, {opts})
|
||||||
@@ -1420,7 +1433,16 @@ show_line_diagnostics({opts}, {bufnr}, {line_nr}, {client_id})
|
|||||||
{client_id} number|nil the client id
|
{client_id} number|nil the client id
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
{popup_bufnr, win_id}
|
table {popup_bufnr, win_id}
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Lua module: vim.lsp.handlers *lsp-handlers*
|
||||||
|
|
||||||
|
*vim.lsp.handlers.progress_callback()*
|
||||||
|
progress_callback({_}, {_}, {params}, {client_id})
|
||||||
|
See also: ~
|
||||||
|
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@@ -1615,6 +1637,9 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
|
|||||||
See also: ~
|
See also: ~
|
||||||
|softtabstop|
|
|softtabstop|
|
||||||
|
|
||||||
|
get_progress_messages() *vim.lsp.util.get_progress_messages()*
|
||||||
|
TODO: Documentation
|
||||||
|
|
||||||
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
|
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
|
||||||
Jumps to a location.
|
Jumps to a location.
|
||||||
|
|
||||||
@@ -1636,6 +1661,19 @@ locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
|
|||||||
Return: ~
|
Return: ~
|
||||||
(table) list of items
|
(table) list of items
|
||||||
|
|
||||||
|
lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()*
|
||||||
|
Helper function to return nested values in language server
|
||||||
|
settings
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{settings} a table of language server settings
|
||||||
|
{section} a string indicating the field of the settings
|
||||||
|
table
|
||||||
|
|
||||||
|
Return: ~
|
||||||
|
(table or string) The value of settings accessed via
|
||||||
|
section
|
||||||
|
|
||||||
*vim.lsp.util.make_floating_popup_options()*
|
*vim.lsp.util.make_floating_popup_options()*
|
||||||
make_floating_popup_options({width}, {height}, {opts})
|
make_floating_popup_options({width}, {height}, {opts})
|
||||||
Creates a table with sensible default options for a floating
|
Creates a table with sensible default options for a floating
|
||||||
|
|||||||
@@ -1265,12 +1265,10 @@ validate({opt}) *vim.validate()*
|
|||||||
|
|
||||||
vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
|
vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
|
||||||
=> NOP (success)
|
=> NOP (success)
|
||||||
<
|
|
||||||
>
|
|
||||||
vim.validate{arg1={1, 'table'}}
|
vim.validate{arg1={1, 'table'}}
|
||||||
=> error('arg1: expected table, got number')
|
=> error('arg1: expected table, got number')
|
||||||
<
|
|
||||||
>
|
|
||||||
vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
|
vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
|
||||||
=> error('arg1: expected even number, got 3')
|
=> error('arg1: expected even number, got 3')
|
||||||
<
|
<
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ local function validate_client_config(config)
|
|||||||
on_error = { config.on_error, "f", true };
|
on_error = { config.on_error, "f", true };
|
||||||
on_exit = { config.on_exit, "f", true };
|
on_exit = { config.on_exit, "f", true };
|
||||||
on_init = { config.on_init, "f", true };
|
on_init = { config.on_init, "f", true };
|
||||||
|
settings = { config.settings, "t", true };
|
||||||
before_init = { config.before_init, "f", true };
|
before_init = { config.before_init, "f", true };
|
||||||
offset_encoding = { config.offset_encoding, "s", true };
|
offset_encoding = { config.offset_encoding, "s", true };
|
||||||
flags = { config.flags, "t", true };
|
flags = { config.flags, "t", true };
|
||||||
@@ -400,6 +401,10 @@ end
|
|||||||
---
|
---
|
||||||
--@param handlers Map of language server method names to |lsp-handler|
|
--@param handlers Map of language server method names to |lsp-handler|
|
||||||
---
|
---
|
||||||
|
--@param settings Map with language server specific settings. These are
|
||||||
|
--- returned to the language server if requested via `workspace/configuration`.
|
||||||
|
--- Keys are case-sensitive.
|
||||||
|
---
|
||||||
--@param init_options Values to pass in the initialization request
|
--@param init_options Values to pass in the initialization request
|
||||||
--- as `initializationOptions`. See `initialize` in the LSP spec.
|
--- as `initializationOptions`. See `initialize` in the LSP spec.
|
||||||
---
|
---
|
||||||
@@ -426,7 +431,10 @@ end
|
|||||||
--- the server may send. For example, clangd sends
|
--- the server may send. For example, clangd sends
|
||||||
--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was
|
--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was
|
||||||
--- sent to it. You can only modify the `client.offset_encoding` here before
|
--- sent to it. You can only modify the `client.offset_encoding` here before
|
||||||
--- any notifications are sent.
|
--- any notifications are sent. Most language servers expect to be sent client specified settings after
|
||||||
|
--- initialization. Neovim does not make this assumption. A
|
||||||
|
--- `workspace/didChangeConfiguration` notification should be sent
|
||||||
|
--- to the server during on_init.
|
||||||
---
|
---
|
||||||
--@param on_exit Callback (code, signal, client_id) invoked on client
|
--@param on_exit Callback (code, signal, client_id) invoked on client
|
||||||
--- exit.
|
--- exit.
|
||||||
|
|||||||
Reference in New Issue
Block a user