Home Explore Blog CI



neovim

36th chunk of `runtime/doc/lsp.txt`
30dc797bd5d8ec83740cf958aae675b0ef5d442d0fdd9d990000000100000fc5
 {row}, {col}, {offset_encoding})
    Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.

    Parameters: ~
      • {buf}              (`integer`) buffer number (0 for current)
      • {row}              (`integer`) 0-indexed line
      • {col}              (`integer`) 0-indexed byte offset in line
      • {offset_encoding}  (`'utf-8'|'utf-16'|'utf-32'?`) defaults to
                           `offset_encoding` of first client of `buf`

    Return: ~
        (`integer`) `offset_encoding` index of the character in line {row}
        column {col} in buffer {buf}

                              *vim.lsp.util.convert_input_to_markdown_lines()*
convert_input_to_markdown_lines({input}, {contents})
    Converts any of `MarkedString` | `MarkedString[]` | `MarkupContent` into a
    list of lines containing valid markdown. Useful to populate the hover
    window for `textDocument/hover`, for parsing the result of
    `textDocument/signatureHelp`, and potentially others.

    Note that if the input is of type `MarkupContent` and its kind is
    `plaintext`, then the corresponding value is returned without further
    modifications.

    Parameters: ~
      • {input}     (`lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent`)
      • {contents}  (`string[]?`) List of strings to extend with converted
                    lines. Defaults to {}.

    Return: ~
        (`string[]`) extended with lines of converted markdown.

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

                     *vim.lsp.util.convert_signature_help_to_markdown_lines()*
convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers})
    Converts `textDocument/signatureHelp` response to markdown lines.

    Parameters: ~
      • {signature_help}  (`lsp.SignatureHelp`) Response of
                          `textDocument/SignatureHelp`
      • {ft}              (`string?`) filetype that will be use as the `lang`
                          for the label markdown code block
      • {triggers}        (`string[]?`) list of trigger characters from the
                          lsp server. used to better determine parameter
                          offsets

    Return (multiple): ~
        (`string[]?`) lines of converted markdown.
        (`Range4?`) highlight range for the active parameter

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

get_effective_tabstop({bufnr})          *vim.lsp.util.get_effective_tabstop()*
    Returns indentation size.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer handle, defaults to current

    Return: ~
        (`integer`) indentation size

    See also: ~
      • 'shiftwidth'

                                           *vim.lsp.util.locations_to_items()*
locations_to_items({locations}, {position_encoding})
    Returns the items with the 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

Title: vim.lsp.util - More Functions for LSP Utilities
Summary
This section continues describing functions within the `vim.lsp.util` module, focusing on LSP utilities. It details functions for converting inputs to markdown lines (`convert_input_to_markdown_lines`), converting signature help responses to markdown lines (`convert_signature_help_to_markdown_lines`), retrieving the effective tabstop size (`get_effective_tabstop`), converting locations to items for quickfix/location lists (`locations_to_items`), and creating options for floating popup windows (`make_floating_popup_options`).