Home Explore Blog CI



neovim

34th chunk of `runtime/doc/lsp.txt`
6020574ddc1a18ade3366bfa395b982fef3f15004ec961e40000000100000fd8
        vim.lsp.document_color.enable(true, args.buf)
          end
        })
<

    To "toggle", pass the inverse of `is_enabled()`: >lua
        vim.lsp.document_color.enable(not vim.lsp.document_color.is_enabled())
<

    Parameters: ~
      • {enable}  (`boolean?`) True to enable, false to disable. (default:
                  `true`)
      • {bufnr}   (`integer?`) Buffer handle, or 0 for current. (default: 0)
      • {opts}    (`table?`) A table with the following fields:
                  • {style}?
                    (`'background'|'foreground'|'virtual'|string|fun(bufnr: integer, range: Range4, hex_code: string)`)
                    Highlight style. It can be one of the pre-defined styles,
                    a string to be used as virtual text, or a function that
                    receives the buffer handle, the range (start line, start
                    col, end line, end col) and the resolved hex color.
                    (default: `'background'`)

is_enabled({bufnr})                      *vim.lsp.document_color.is_enabled()*
    Query whether document colors are enabled in the given buffer.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer handle, or 0 for current. (default: 0)

    Return: ~
        (`boolean`)


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

*vim.lsp.util.open_floating_preview.Opts*

    Fields: ~
      • {height}?        (`integer`) Height of floating window
      • {width}?         (`integer`) Width of floating window
      • {wrap}?          (`boolean`, default: `true`) Wrap long lines
      • {wrap_at}?       (`integer`) Character to wrap at for computing height
                         when wrap is enabled
      • {max_width}?     (`integer`) Maximal width of floating window
      • {max_height}?    (`integer`) Maximal height of floating window
      • {focus_id}?      (`string`) If a popup with this id is opened, then
                         focus it
      • {close_events}?  (`table`) List of events that closes the floating
                         window
      • {focusable}?     (`boolean`, default: `true`) Make float focusable.
      • {focus}?         (`boolean`, default: `true`) If `true`, and if
                         {focusable} is also `true`, focus an existing
                         floating window with the same {focus_id}
      • {offset_x}?      (`integer`) offset to add to `col`
      • {offset_y}?      (`integer`) offset to add to `row`
      • {border}?        (`string|(string|[string,string])[]`) override
                         `border`
      • {zindex}?        (`integer`) override `zindex`, defaults to 50
      • {title}?         (`string|[string,string][]`)
      • {title_pos}?     (`'left'|'center'|'right'`)
      • {relative}?      (`'mouse'|'cursor'|'editor'`) (default: `'cursor'`)
      • {anchor_bias}?   (`'auto'|'above'|'below'`, default: `'auto'`) Adjusts
                         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

Title: vim.lsp.document_color.is_enabled() and vim.lsp.util
Summary
This section describes the `is_enabled` function within the `vim.lsp.document_color` module, which checks if document colors are enabled in a given buffer. It then introduces the `vim.lsp.util` module, specifically outlining the fields available in the `vim.lsp.util.open_floating_preview.Opts` table, which configures the appearance and behavior of floating preview windows. Finally, it describes the `apply_text_document_edit` function which applies a set of changes to a single document.