Home Explore Blog CI



neovim

35th chunk of `runtime/doc/lsp.txt`
db5d767092c0a870b4b65e44e28d06a58084529733d846080000000100000fd1
                       placement relative to cursor.
                         • "auto": place window based on which side of the
                           cursor has more lines
                         • "above": place the window above the cursor unless
                           there are not enough lines to display the full
                           window height.
                         • "below": place the window below the cursor unless
                           there are not enough lines to display the full
                           window height.


                                     *vim.lsp.util.apply_text_document_edit()*
apply_text_document_edit({text_document_edit}, {index}, {position_encoding})
    Applies a `TextDocumentEdit`, which is a list of changes to a single
    document.

    Parameters: ~
      • {text_document_edit}  (`lsp.TextDocumentEdit`)
      • {index}               (`integer?`) Optional index of the edit, if from
                              a list of edits (or nil, if not from a list)
      • {position_encoding}   (`'utf-8'|'utf-16'|'utf-32'?`)

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

                                             *vim.lsp.util.apply_text_edits()*
apply_text_edits({text_edits}, {bufnr}, {position_encoding})
    Applies a list of text edits to a buffer.

    Parameters: ~
      • {text_edits}         (`lsp.TextEdit[]`)
      • {bufnr}              (`integer`) Buffer id
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'`)

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

                                         *vim.lsp.util.apply_workspace_edit()*
apply_workspace_edit({workspace_edit}, {position_encoding})
    Applies a `WorkspaceEdit`.

    Parameters: ~
      • {workspace_edit}     (`lsp.WorkspaceEdit`)
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'`) (required)

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

buf_clear_references({bufnr})            *vim.lsp.util.buf_clear_references()*
    Removes document highlights from a buffer.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer id

                                     *vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {position_encoding})
    Shows a list of document highlights for a certain buffer.

    Parameters: ~
      • {bufnr}              (`integer`) Buffer id
      • {references}         (`lsp.DocumentHighlight[]`) objects to highlight
      • {position_encoding}  (`'utf-8'|'utf-16'|'utf-32'`)

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

                                             *vim.lsp.util.character_offset()*
character_offset({buf}, {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

Title: vim.lsp.util - More Functions
Summary
This section describes more functions within the `vim.lsp.util` module. It includes functions for applying text document edits (`apply_text_document_edit`), applying a list of text edits to a buffer (`apply_text_edits`), applying a workspace edit (`apply_workspace_edit`), clearing document highlights from a buffer (`buf_clear_references`), highlighting document references (`buf_highlight_references`), calculating character offsets in a buffer (`character_offset`), and converting various input types into markdown lines (`convert_input_to_markdown_lines`).