Home Explore Blog CI



neovim

32th chunk of `runtime/doc/lsp.txt`
42a61868318ff4ce8480cb463cbb975fd383caabf7922a910000000100000fd1
 })[1] -- 0 for current buffer

        local client = vim.lsp.get_client_by_id(hint.client_id)
        local resp = client:request_sync('inlayHint/resolve', hint.inlay_hint, 100, 0)
        local resolved_hint = assert(resp and resp.result, resp.err)
        vim.lsp.util.apply_text_edits(resolved_hint.textEdits, 0, client.encoding)

        location = resolved_hint.label[1].location
        client:request('textDocument/hover', {
          textDocument = { uri = location.uri },
          position = location.range.start,
        })
<

    Attributes: ~
        Since: 0.10.0

    Parameters: ~
      • {filter}  (`table?`) Optional filters |kwargs|:
                  • {bufnr} (`integer?`)
                  • {range} (`lsp.Range?`)

    Return: ~
        (`table[]`) A list of objects with the following fields:
        • {bufnr} (`integer`)
        • {client_id} (`integer`)
        • {inlay_hint} (`lsp.InlayHint`)

is_enabled({filter})                         *vim.lsp.inlay_hint.is_enabled()*
    Query whether inlay hint is enabled in the {filter}ed scope

    Attributes: ~
        Since: 0.10.0

    Parameters: ~
      • {filter}  (`table?`) Optional filters |kwargs|, or `nil` for all.
                  • {bufnr} (`integer?`) Buffer number, or 0 for current
                    buffer, or nil for all.

    Return: ~
        (`boolean`)


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

force_refresh({bufnr})               *vim.lsp.semantic_tokens.force_refresh()*
    Force a refresh of all semantic tokens

    Only has an effect if the buffer is currently active for semantic token
    highlighting (|vim.lsp.semantic_tokens.start()| has been called for it)

    Parameters: ~
      • {bufnr}  (`integer?`) filter by buffer. All buffers if nil, current
                 buffer if 0

                                        *vim.lsp.semantic_tokens.get_at_pos()*
get_at_pos({bufnr}, {row}, {col})
    Return the semantic token(s) at the given position. If called without
    arguments, returns the token under the cursor.

    Parameters: ~
      • {bufnr}  (`integer?`) Buffer number (0 for current buffer, default)
      • {row}    (`integer?`) Position row (default cursor position)
      • {col}    (`integer?`) Position column (default cursor position)

    Return: ~
        (`table?`) List of tokens at position. Each token has the following
        fields:
        • line (integer) line number, 0-based
        • start_col (integer) start column, 0-based
        • end_col (integer) end column, 0-based
        • type (string) token type as string, e.g. "variable"
        • modifiers (table) token modifiers as a set. E.g., { static = true,
          readonly = true }
        • client_id (integer)

                                   *vim.lsp.semantic_tokens.highlight_token()*
highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts})
    Highlight a semantic token.

    Apply an extmark with a given highlight group for a semantic token. The
    mark will be deleted by the semantic token engine when appropriate; for
    example, when the LSP sends updated tokens. This function is intended for
    use inside |LspTokenUpdate| callbacks.

    Parameters: ~
      • {token}      (`table`) A semantic token, found as `args.data.token` in
                     |LspTokenUpdate|
      • {bufnr}      (`integer`) The buffer to highlight, or `0` for current
                     buffer
      • {client_id}  (`integer`) The ID of the |vim.lsp.Client|
      • {hl_group}   (`string`) Highlight group name
      • {opts}       (`table?`) Optional parameters:
                     • {priority}? (`integer`, default:
                       `vim.hl.priorities.semantic_tokens + 3`) Priority for
                       the applied extmark.

start({bufnr}, {client_id}, {opts})          *vim.lsp.semantic_tokens.start()*
    Start the semantic token highlighting

Title: vim.lsp.inlay_hint Functions (continued) and Introduction to vim.lsp.semantic_tokens
Summary
This section continues detailing the `vim.lsp.inlay_hint` module with the `is_enabled` function which queries whether inlay hint is enabled in the filtered scope. The section then introduces the `vim.lsp.semantic_tokens` module. It starts with the `force_refresh` function, which forces a refresh of all semantic tokens, then it moves to the `get_at_pos` function, which returns the semantic tokens at the given position, then to `highlight_token` which applies an extmark with a given highlight group for a semantic token. Finally, it introduces the `start` function used to start the semantic token highlighting.