Home Explore Blog CI



neovim

37th chunk of `runtime/doc/lsp.txt`
86e2d773d3e09a55e5d832962c81a3963558b4faf046a92c0000000100000fc0
 byte position calculated correctly and in
    sorted order, for display in quickfix and location lists.

    The `user_data` field of each resulting item will contain the original
    `Location` or `LocationLink` it was computed from.

    The result can be passed to the {list} argument of |setqflist()| or
    |setloclist()|.

    Parameters: ~
      • {locations}          (`lsp.Location[]|lsp.LocationLink[]`)
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'?`) default to first
                             client of buffer

    Return: ~
        (`vim.quickfix.entry[]`) See |setqflist()| for the format

                                  *vim.lsp.util.make_floating_popup_options()*
make_floating_popup_options({width}, {height}, {opts})
    Creates a table with sensible default options for a floating window. The
    table can be passed to |nvim_open_win()|.

    Parameters: ~
      • {width}   (`integer`) window width (in character cells)
      • {height}  (`integer`) window height (in character cells)
      • {opts}    (`vim.lsp.util.open_floating_preview.Opts?`) See
                  |vim.lsp.util.open_floating_preview.Opts|.

    Return: ~
        (`vim.api.keyset.win_config`)

                                       *vim.lsp.util.make_formatting_params()*
make_formatting_params({options})
    Creates a `DocumentFormattingParams` object for the current buffer and
    cursor position.

    Parameters: ~
      • {options}  (`lsp.FormattingOptions?`) with valid `FormattingOptions`
                   entries

    Return: ~
        (`lsp.DocumentFormattingParams`) object

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

                                      *vim.lsp.util.make_given_range_params()*
make_given_range_params({start_pos}, {end_pos}, {bufnr}, {position_encoding})
    Using the given range in the current buffer, creates an object that is
    similar to |vim.lsp.util.make_range_params()|.

    Parameters: ~
      • {start_pos}          (`[integer,integer]?`) {row,col} mark-indexed
                             position. Defaults to the start of the last
                             visual selection.
      • {end_pos}            (`[integer,integer]?`) {row,col} mark-indexed
                             position. Defaults to the end of the last visual
                             selection.
      • {bufnr}              (`integer?`) buffer handle or 0 for current,
                             defaults to current
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'`)

    Return: ~
        (`{ textDocument: { uri: lsp.DocumentUri }, range: lsp.Range }`)

                                         *vim.lsp.util.make_position_params()*
make_position_params({window}, {position_encoding})
    Creates a `TextDocumentPositionParams` object for the current buffer and
    cursor position.

    Parameters: ~
      • {window}             (`integer?`) |window-ID| or 0 for current,
                             defaults to current
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'`)

    Return: ~
        (`lsp.TextDocumentPositionParams`)

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

                                            *vim.lsp.util.make_range_params()*
make_range_params({window}, {position_encoding})
    Using the current position in the current buffer, creates an object that
    can be used as a building block for several LSP requests, such as
    `textDocument/codeAction`, `textDocument/colorPresentation`,
    `textDocument/rangeFormatting`.

    Parameters: ~
      • {window}             (`integer?`) |window-ID| or 0 for current,
                             defaults to current
      • {position_encoding}  (`"utf-8"|"utf-16"|"utf-32"`)

    Return: ~
        (`{ textDocument: { uri: lsp.DocumentUri }, range: lsp.Range }`)

  

Title: vim.lsp.util - Functions for LSP Parameters and Window Options
Summary
This section describes functions in `vim.lsp.util` that aid in creating parameters for Language Server Protocol (LSP) requests and configuring floating windows. It covers functions for creating options for floating popup windows (`make_floating_popup_options`), creating `DocumentFormattingParams` objects (`make_formatting_params`), creating range parameters (`make_given_range_params`, `make_range_params`), and creating `TextDocumentPositionParams` objects (`make_position_params`).