aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/lsp.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/lsp.txt')
-rw-r--r--runtime/doc/lsp.txt158
1 files changed, 68 insertions, 90 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 1e84402a9f..9bd304cbb4 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -521,7 +521,9 @@ buf_request({bufnr}, {method}, {params}, {handler})
{method} (string) LSP method name
{params} (optional, table) Parameters to send to the
server
- {handler} (optional, function) See |lsp-handler|
+ {handler} (optional, function) See |lsp-handler| If nil,
+ follows resolution strategy defined in
+ |lsp-handler-configuration|
Return: ~
2-tuple:
@@ -573,9 +575,6 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
error, returns `(nil, err)` where `err` is a string
describing the failure reason.
-check_clients_closed() *vim.lsp.check_clients_closed()*
- TODO: Documentation
-
client() *vim.lsp.client*
LSP client object. You can get an active client object via
|vim.lsp.get_client_by_id()| or
@@ -648,12 +647,21 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Return: ~
true if client is stopped, false otherwise.
-flush({client}) *vim.lsp.flush()*
- TODO: Documentation
-
*vim.lsp.for_each_buffer_client()*
for_each_buffer_client({bufnr}, {fn})
- TODO: Documentation
+ Invokes a function for each LSP client attached to a buffer.
+
+ Parameters: ~
+ {bufnr} number Buffer number
+ {fn} function Function to run on each client attached
+ to buffer {bufnr}. The function takes the client,
+ client ID, and buffer number as arguments.
+ Example: >
+
+ vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr)
+ print(vim.inspect(client))
+ end)
+<
formatexpr({opts}) *vim.lsp.formatexpr()*
Provides an interface between the built-in client and a
@@ -676,6 +684,8 @@ get_active_clients() *vim.lsp.get_active_clients()*
*vim.lsp.get_buffers_by_client_id()*
get_buffers_by_client_id({client_id})
+ Returns list of buffers attached to client_id.
+
Parameters: ~
{client_id} number client id
@@ -717,16 +727,6 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
|complete-items|
|CompleteDone|
- *vim.lsp.prepare()*
-prepare({bufnr}, {firstline}, {lastline}, {new_lastline}, {changedtick})
- TODO: Documentation
-
-reset({client_id}) *vim.lsp.reset()*
- TODO: Documentation
-
-reset_buf({client}, {bufnr}) *vim.lsp.reset_buf()*
- TODO: Documentation
-
set_log_level({level}) *vim.lsp.set_log_level()*
Sets the global log level for LSP logging.
@@ -796,10 +796,11 @@ start_client({config}) *vim.lsp.start_client()*
functions. Commands passed to
start_client take precedence over the
global command registry. Each key
- must be a unique comand name, and the
- value is a function which is called
- if any LSP action (code action, code
- lenses, ...) triggers the command.
+ must be a unique command name, and
+ the value is a function which is
+ called if any LSP action (code
+ action, code lenses, ...) triggers
+ the command.
{init_options} Values to pass in the initialization
request as `initializationOptions` .
See `initialize` in the LSP spec.
@@ -873,6 +874,11 @@ start_client({config}) *vim.lsp.start_client()*
debounce occurs if nil
• exit_timeout (number, default 500):
Milliseconds to wait for server to
+ exit cleanly after sending the
+ 'shutdown' request before sending
+ kill -15. If set to false, nvim
+ exits immediately after sending the
+ 'shutdown' request to the server.
{root_dir} string Directory where the LSP server
will base its workspaceFolders,
rootUri, and rootPath on
@@ -985,9 +991,9 @@ document_highlight() *vim.lsp.buf.document_highlight()*
triggered by a key mapping or by events such as `CursorHold` ,
eg:
>
- vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]]
- vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
- vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
+ autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
+ autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
+ autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
<
Note: Usage of |vim.lsp.buf.document_highlight()| requires the
@@ -1055,7 +1061,7 @@ formatting_sync({options}, {timeout_ms})
|vim.lsp.buf_request_sync()|. Example:
>
- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]
+ autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
<
Parameters: ~
@@ -1087,9 +1093,6 @@ outgoing_calls() *vim.lsp.buf.outgoing_calls()*
cursor in the |quickfix| window. If the symbol can resolve to
multiple items, the user can pick one in the |inputlist|.
-prepare_rename({err}, {result}) *vim.lsp.buf.prepare_rename()*
- TODO: Documentation
-
*vim.lsp.buf.range_code_action()*
range_code_action({context}, {start_pos}, {end_pos})
Performs |vim.lsp.buf.code_action()| for a given range.
@@ -1344,25 +1347,22 @@ buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer.
Parameters: ~
- {bufnr} buffer id
+ {bufnr} number Buffer id
*vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer.
Parameters: ~
- {bufnr} buffer id
- {references} List of `DocumentHighlight` objects to
- highlight
- {offset_encoding} string utf-8|utf-16|utf-32|nil defaults
- to utf-16
+ {bufnr} number Buffer id
+ {references} table List of `DocumentHighlight`
+ objects to highlight
+ {offset_encoding} string One of "utf-8", "utf-16",
+ "utf-32", or nil. Defaults to utf-16
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight
-buf_lines({bufnr}) *vim.lsp.util.buf_lines()*
- TODO: Documentation
-
*vim.lsp.util.character_offset()*
character_offset({bufnr}, {row}, {col})
Returns the UTF-32 and UTF-16 offsets for a position in a
@@ -1429,12 +1429,6 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers})
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
-create_file({change}) *vim.lsp.util.create_file()*
- TODO: Documentation
-
-delete_file({change}) *vim.lsp.util.delete_file()*
- TODO: Documentation
-
*vim.lsp.util.extract_completion_items()*
extract_completion_items({result})
Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null.
@@ -1462,29 +1456,6 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
See also: ~
|softtabstop|
-get_line({uri}, {row}) *vim.lsp.util.get_line()*
- Gets the zero-indexed line from the given uri.
-
- Parameters: ~
- {uri} string uri of the resource to get the line from
- {row} number zero-indexed line number
-
- Return: ~
- string the line at row in filename
-
-get_lines({uri}, {rows}) *vim.lsp.util.get_lines()*
- Gets the zero-indexed lines from the given uri.
-
- Parameters: ~
- {uri} string uri of the resource to get the lines from
- {rows} number[] zero-indexed line numbers
-
- Return: ~
- table<number string> a table mapping rows to lines
-
-get_progress_messages() *vim.lsp.util.get_progress_messages()*
- TODO: Documentation
-
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
Jumps to a location.
@@ -1619,25 +1590,32 @@ open_floating_preview({contents}, {syntax}, {opts})
Parameters: ~
{contents} table of lines to show in window
{syntax} string of syntax to set for opened buffer
- {opts} dictionary with optional fields
- • height of floating window
- • width of floating window
- • wrap boolean enable wrapping of long lines
- (defaults to true)
- • wrap_at character to wrap at for computing
- height when wrap is enabled
- • max_width maximal width of floating window
- • max_height maximal height of floating window
- • pad_top number of lines to pad contents at
- top
- • pad_bottom number of lines to pad contents
- at bottom
- • focus_id if a popup with this id is opened,
- then focus it
- • close_events list of events that closes the
+ {opts} table with optional fields (additional keys
+ are passed on to |vim.api.nvim_open_win()|)
+ • height: (number) height of floating window
+ • width: (number) width of floating window
+ • wrap: (boolean, default true) wrap long
+ lines
+ • wrap_at: (string) character to wrap at for
+ computing height when wrap is enabled
+ • max_width: (number) maximal width of
floating window
- • focusable (boolean, default true): Make
+ • max_height: (number) maximal height of
+ floating window
+ • pad_top: (number) number of lines to pad
+ contents at top
+ • pad_bottom: (number) number of lines to pad
+ contents at bottom
+ • focus_id: (string) if a popup with this id
+ is opened, then focus it
+ • close_events: (table) list of events that
+ closes the floating window
+ • focusable: (boolean, default true) Make
float focusable
+ • focus: (boolean, default true) If `true` ,
+ and if {focusable} is also `true` , focus an
+ existing floating window with the same
+ {focus_id}
Return: ~
bufnr,winnr buffer and window number of the newly created
@@ -1778,7 +1756,10 @@ get_filename() *vim.lsp.log.get_filename()*
(string) log filename
get_level() *vim.lsp.log.get_level()*
- TODO: Documentation
+ Gets the current log level.
+
+ Return: ~
+ string current log level
set_format_func({handle}) *vim.lsp.log.set_format_func()*
Sets formatting function used to format logs
@@ -1857,7 +1838,8 @@ rpc_response_error({code}, {message}, {data})
*vim.lsp.rpc.start()*
start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Starts an LSP server process and create an LSP RPC client
- object to interact with it.
+ object to interact with it. Communication with the server is
+ currently limited to stdio.
Parameters: ~
{cmd} (string) Command to start the LSP
@@ -1916,10 +1898,6 @@ compute_diff({prev_lines}, {curr_lines}, {firstline}, {lastline},
Return: ~
table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent
- *vim.lsp.sync.compute_line_length()*
-compute_line_length({line}, {offset_encoding})
- TODO: Documentation
-
==============================================================================
Lua module: vim.lsp.protocol *lsp-protocol*