Home Explore Blog CI



neovim

17th chunk of `runtime/doc/lsp.txt`
1f750b0afa3716a8b056ea858a2c88fd2afb82bbda956f780000000100000fbc
 detect the root by traversing the file system upwards
      starting from the current directory until either a `pyproject.toml` or
      `setup.py` file is found.
    • `workspace_folders` list of `{ uri:string, name: string }` tables
      specifying the project root folders used by the language server. If
      `nil` the property is derived from `root_dir` for convenience.

    Language servers use this information to discover metadata like the
    dependencies of your project and they tend to index the contents within
    the project folder.

    To ensure a language server is only started for languages it can handle,
    make sure to call |vim.lsp.start()| within a |FileType| autocmd. Either
    use |:au|, |nvim_create_autocmd()| or put the call in a
    `ftplugin/<filetype_name>.lua` (See |ftplugin-name|)

    Attributes: ~
        Since: 0.8.0

    Parameters: ~
      • {config}  (`vim.lsp.ClientConfig`) Configuration for the server. See
                  |vim.lsp.ClientConfig|.
      • {opts}    (`table?`) Optional keyword arguments.
                  • {reuse_client}?
                    (`fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean`)
                    Predicate used to decide if a client should be re-used.
                    Used on all running clients. The default implementation
                    re-uses a client if it has the same name and if the given
                    workspace folders (or root_dir) are all included in the
                    client's workspace folders.
                  • {bufnr}? (`integer`) Buffer handle to attach to if
                    starting or re-using a client (0 for current).
                  • {attach}? (`boolean`) Whether to attach the client to a
                    buffer (default true). If set to `false`, `reuse_client`
                    and `bufnr` will be ignored.
                  • {silent}? (`boolean`) Suppress error reporting if the LSP
                    server fails to start (default false).

    Return: ~
        (`integer?`) client_id

status()                                                    *vim.lsp.status()*
    Consumes the latest progress messages from all clients and formats them as
    a string. Empty if there are no clients or if no new messages

    Return: ~
        (`string`)

stop_client({client_id}, {force})                      *vim.lsp.stop_client()*
    Stops a client(s).

    You can also use the `stop()` function on a |vim.lsp.Client| object. To
    stop all clients: >lua
        vim.lsp.stop_client(vim.lsp.get_clients())
<

    By default asks the server to shutdown, unless stop was requested already
    for this client, then force-shutdown is attempted.

    Parameters: ~
      • {client_id}  (`integer|integer[]|vim.lsp.Client[]`) id, list of id's,
                     or list of |vim.lsp.Client| objects
      • {force}      (`boolean?`) shutdown forcefully

tagfunc({pattern}, {flags})                                *vim.lsp.tagfunc()*
    Provides an interface between the built-in client and 'tagfunc'.

    When used with normal mode commands (e.g. |CTRL-]|) this will invoke the
    "textDocument/definition" LSP method to find the tag under the cursor.
    Otherwise, uses "workspace/symbol". If no results are returned from any
    LSP servers, falls back to using built-in tags.

    Parameters: ~
      • {pattern}  (`string`) Pattern used to find a workspace symbol
      • {flags}    (`string`) See |tag-function|

    Return: ~
        (`table[]`) tags A list of matching tags


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

*vim.lsp.Client*

    Fields: ~
      • {attached_buffers}      (`table<integer,true>`)
      • {capabilities}          (`lsp.ClientCapabilities`) Capabilities
                                provided by the client (editor or tool), at
                                startup.
      •

Title: vim.lsp Functions: Starting Clients, Managing Status, and Handling Tags
Summary
This section details functions related to LSP client management in Vim. It describes the parameters for starting a client with `vim.lsp.start()`, including options for reusing clients, attaching to buffers, and suppressing errors. It also covers `vim.lsp.status()` for retrieving the latest progress messages from all clients, `vim.lsp.stop_client()` for stopping a client (or clients) gracefully or forcefully, and `vim.lsp.tagfunc()` for integrating with Vim's tag functionality using LSP methods.