Home Explore Blog CI



neovim

42th chunk of `runtime/doc/lsp.txt`
d684ce0adec4ea2bc5f20d6e5c461c5dc5df7553fad9cdad0000000100000d21
 (`integer?`) message_id if request could be sent, `nil` if not

                                            *vim.lsp.rpc.rpc_response_error()*
rpc_response_error({code}, {message}, {data})
    Creates an RPC response table `error` to be sent to the LSP response.

    Parameters: ~
      • {code}     (`integer`) RPC error code defined, see
                   `vim.lsp.protocol.ErrorCodes`
      • {message}  (`string?`) arbitrary message to send to server
      • {data}     (`any?`) arbitrary data to send to server

    Return: ~
        (`lsp.ResponseError`)

    See also: ~
      • lsp.ErrorCodes See `vim.lsp.protocol.ErrorCodes`

start({cmd}, {dispatchers}, {extra_spawn_params})        *vim.lsp.rpc.start()*
    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: ~
      • {cmd}                 (`string[]`) Command to start the LSP server.
      • {dispatchers}         (`table?`) Dispatchers for LSP message types.
                              • {notification}
                                (`fun(method: string, params: table)`)
                              • {server_request}
                                (`fun(method: string, params: table): any?, lsp.ResponseError?`)
                              • {on_exit}
                                (`fun(code: integer, signal: integer)`)
                              • {on_error} (`fun(code: integer, err: any)`)
      • {extra_spawn_params}  (`table?`) Additional context for the LSP server
                              process.
                              • {cwd}? (`string`) Working directory for the
                                LSP server process
                              • {detached}? (`boolean`) Detach the LSP server
                                process from the current process
                              • {env}? (`table<string,string>`) Additional
                                environment variables for LSP server process.
                                See |vim.system()|

    Return: ~
        (`vim.lsp.rpc.PublicClient`) See |vim.lsp.rpc.PublicClient|.


==============================================================================
Lua module: vim.lsp.protocol                                    *lsp-protocol*

                                 *vim.lsp.protocol.make_client_capabilities()*
make_client_capabilities()
    Gets a new ClientCapabilities object describing the LSP client
    capabilities.

    Return: ~
        (`lsp.ClientCapabilities`)

Methods                                             *vim.lsp.protocol.Methods*
    LSP method names.

    See also: ~
      • https://microsoft.github.io/language-server-protocol/specification/#metaModel

                                     *vim.lsp.protocol.resolve_capabilities()*
resolve_capabilities({server_capabilities})
    Creates a normalized object describing LSP server capabilities.

    Parameters: ~
      • {server_capabilities}  (`table`) Table of capabilities supported by
                               the server

    Return: ~
        (`lsp.ServerCapabilities?`) Normalized table of capabilities


 vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:

Title: vim.lsp.rpc.start() and vim.lsp.protocol
Summary
This section details `vim.lsp.rpc.start()`, which initiates an LSP server process and an RPC client for interaction, including parameters for the command, dispatchers for LSP message types, and additional process context. It then transitions to the `vim.lsp.protocol` module, covering `make_client_capabilities()` to generate a ClientCapabilities object, listing LSP method names in `Methods`, and `resolve_capabilities()` to create a normalized object of server capabilities.