diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2022-08-29 18:26:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 18:26:14 +0200 |
commit | 126fe7fbc9c88c412c8067d9d146d998baf6dd47 (patch) | |
tree | df3b180aeb473deb95c68cf4cececfd7412f9bef /runtime/doc | |
parent | 92bc11a891538e5c306915bffef437f097572d09 (diff) | |
parent | 60ec6e34d585a7f633d49aab790066c1740885e1 (diff) | |
download | rneovim-126fe7fbc9c88c412c8067d9d146d998baf6dd47.tar.gz rneovim-126fe7fbc9c88c412c8067d9d146d998baf6dd47.tar.bz2 rneovim-126fe7fbc9c88c412c8067d9d146d998baf6dd47.zip |
Merge pull request #19916 from mfussenegger/lsp-tcp
Adds TCP support for lsp.
Usage example:
```
vim.lsp.start({ name = 'godot', cmd = vim.lsp.rpc.connect('127.0.0.1', 6008) })
```
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lsp.txt | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 9235fdef34..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. @@ -1904,7 +1922,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 +1933,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 |