nvim_runtime_lua

vim.lsp.rpc

Methods4

function M.format_rpc_error(err: table) -> error_message string

Constructs an error message from an LSP error object.

Parameters
errtable

The error object

Returns
error_messagestring

The formatted error message

function M.rpc_response_error(code: integer, message: nil | string, data: any) -> lsp.ResponseError

Creates an RPC response table error to be sent to the LSP response.

Parameters
codeinteger

RPC error code defined, see vim.lsp.protocol.ErrorCodes

messagenil | string

arbitrary message to send to server

dataany

arbitrary data to send to server

See:

lsp.ErrorCodes See vim.lsp.protocol.ErrorCodes

function M.connect(host_or_path: string, port: nil | integer) -> fun(dispatchers: vim.lsp.rpc.Dispatchers) -> vim.lsp.rpc.Client

Create a LSP RPC client factory that connects to either:

  • a named pipe (windows)
  • a domain socket (unix)
  • a host and port via TCP

Return a function that can be passed to the cmd field for |vim.lsp.start()|.

Parameters
host_or_pathstring

host to connect to or path to a pipe/domain socket

portnil | integer

TCP port to connect to. If absent the first argument must be a pipe

Returns
function M.start(cmd: string[], dispatchers: vim.lsp.rpc.Dispatchers | nil, extra_spawn_params: vim.net.transport.ExtraSpawnParams | nil) -> vim.lsp.rpc.Client

Starts an LSP server process and create an LSP RPC client object to interact with it. Communication with the spawned process happens via stdio. For communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect()|

Parameters
cmdstring[]

Command to start the LSP server.

dispatchersvim.lsp.rpc.Dispatchers | nil
extra_spawn_paramsvim.net.transport.ExtraSpawnParams | nil

Fields1

M.client_errors : {string, integer} | {integer, string}

@nodoc