Home Explore Blog CI



neovim

27th chunk of `runtime/doc/lsp.txt`
7e2c38c99e53bc83b67ba291ab87a64d966705fbf46db2850000000100000fb4
 vim.lsp.Client): boolean?`)
                  Predicate used to filter clients. Receives a client as
                  argument and must return a boolean. Clients matching the
                  predicate are included. Example: >lua
                    -- Never request typescript-language-server for formatting
                    vim.lsp.buf.format {
                      filter = function(client) return client.name ~= "ts_ls" end
                    }
<
                • {async}? (`boolean`, default: false) If true the method
                  won't block. Editing the buffer while formatting
                  asynchronous can lead to unexpected changes.
                • {id}? (`integer`) Restrict formatting to the client with ID
                  (client.id) matching this field.
                • {name}? (`string`) Restrict formatting to the client with
                  name (client.name) matching this field.
                • {range}?
                  (`{start:[integer,integer],end:[integer, integer]}|{start:[integer,integer],end:[integer,integer]}[]`,
                  default: current selection in visual mode, `nil` in other
                  modes, formatting the full buffer) Range to format. Table
                  must contain `start` and `end` keys with {row,col} tuples
                  using (1,0) indexing. Can also be a list of tables that
                  contain `start` and `end` keys as described above, in which
                  case `textDocument/rangesFormatting` support is required.

hover({config})                                          *vim.lsp.buf.hover()*
    Displays hover information about the symbol under the cursor in a floating
    window. The window will be dismissed on cursor move. Calling the function
    twice will jump into the floating window (thus by default, "KK" will open
    the hover window and focus it). In the floating window, all commands and
    mappings are available as usual, except that "q" dismisses the window. You
    can scroll the contents the same as you would any other buffer.

    Note: to disable hover highlights, add the following to your config: >lua
        vim.api.nvim_create_autocmd('ColorScheme', {
          callback = function()
            vim.api.nvim_set_hl(0, 'LspReferenceTarget', {})
          end,
        })
<

    Parameters: ~
      • {config}  (`vim.lsp.buf.hover.Opts?`) See |vim.lsp.buf.hover.Opts|.

implementation({opts})                          *vim.lsp.buf.implementation()*
    Lists all the implementations for the symbol under the cursor in the
    quickfix window.

    Parameters: ~
      • {opts}  (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.

incoming_calls()                                *vim.lsp.buf.incoming_calls()*
    Lists all the call sites of the symbol under the cursor in the |quickfix|
    window. If the symbol can resolve to multiple items, the user can pick one
    in the |inputlist()|.

list_workspace_folders()                *vim.lsp.buf.list_workspace_folders()*
    List workspace folders.

outgoing_calls()                                *vim.lsp.buf.outgoing_calls()*
    Lists all the items that are called by the symbol under the cursor in the
    |quickfix| window. If the symbol can resolve to multiple items, the user
    can pick one in the |inputlist()|.

references({context}, {opts})                       *vim.lsp.buf.references()*
    Lists all the references to the symbol under the cursor in the quickfix
    window.

    Parameters: ~
      • {context}  (`lsp.ReferenceContext?`) Context for the request
      • {opts}     (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.

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

                                       *vim.lsp.buf.remove_workspace_folder()*
remove_workspace_folder({workspace_folder})
    Remove the folder at path from the workspace folders. If {path} is not
    provided, the

Title: vim.lsp.buf Functions: Formatting Options, Hover Information, and References
Summary
This section details more `vim.lsp.buf` functions, expanding on the formatting options, including filtering clients and specifying ranges. It describes `hover`, which displays information about a symbol in a floating window. Additionally, it covers `implementation`, `incoming_calls`, `outgoing_calls`, and `references`, all of which list relevant code locations in the quickfix window.