From 7d3e4aee6a11f0bd4c53b0dcb18a496b5fdd32b2 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Tue, 23 Aug 2022 22:39:34 +0200 Subject: refactor(lsp): encapsulate rpc uv handle To prepare for different transports like TCP where the handle won't have a kill method. --- runtime/doc/lsp.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 9235fdef34..9661a43e4c 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1904,7 +1904,7 @@ notify({method}, {params}) *vim.lsp.rpc.notify()* Parameters: ~ {method} (string) The invoked LSP method - {params} (table): Parameters for the invoked LSP method + {params} (table|nil): Parameters for the invoked LSP method Return: ~ (bool) `true` if notification could be sent, `false` if not @@ -1915,7 +1915,8 @@ request({method}, {params}, {callback}, {notify_reply_callback}) Parameters: ~ {method} (string) The invoked LSP method - {params} (table) Parameters for the invoked LSP method + {params} (table|nil) Parameters for the invoked LSP + method {callback} (function) Callback to invoke {notify_reply_callback} (function|nil) Callback to invoke as soon as a request is no longer pending -- cgit From 60ec6e34d585a7f633d49aab790066c1740885e1 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Wed, 24 Aug 2022 20:25:34 +0200 Subject: feat(lsp): add tcp support --- runtime/doc/lsp.txt | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 9661a43e4c..82d94afdc8 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -825,7 +825,7 @@ start({config}, {opts}) *vim.lsp.start()* re-uses a client if name and root_dir matches. Return: ~ - (number) client_id + (number|nil) client_id start_client({config}) *vim.lsp.start_client()* Starts and initializes a client with the given configuration. @@ -835,9 +835,16 @@ start_client({config}) *vim.lsp.start_client()* The following parameters describe fields in the {config} table. Parameters: ~ - {cmd} (required, string or list treated like - |jobstart()|) Base command that initiates the LSP - client. + {cmd} (table|string|fun(dispatchers: table):table) + command string or list treated like |jobstart|. + The command must launch the language server + process. `cmd` can also be a function that + creates an RPC client. The function receives a + dispatchers table and must return a table with + the functions `request`, `notify`, `is_closing` + and `terminate` See |vim.lsp.rpc.request| and + |vim.lsp.rpc.notify| For TCP there is a built-in + rpc client factory: |vim.lsp.rpc.connect| {cmd_cwd} (string, default=|getcwd()|) Directory to launch the `cmd` process. Not related to `root_dir`. {cmd_env} (table) Environment flags to pass to the LSP on @@ -1890,6 +1897,17 @@ should_log({level}) *vim.lsp.log.should_log()* ============================================================================== Lua module: vim.lsp.rpc *lsp-rpc* +connect({host}, {port}) *vim.lsp.rpc.connect()* + Create a LSP RPC client factory that connects via TCP to the given host + and port + + Parameters: ~ + {host} (string) + {port} (number) + + Return: ~ + (function) + format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()* Constructs an error message from an LSP error object. -- cgit