nvim_runtime_lua

vim.lsp.Capability

Abstract base class (not instantiable directly). For each buffer that has at least one supported client attached, exactly one instance of each concrete subclass is created. That instance is destroyed once all supporting clients detach from the buffer.

Methods9

function Capability.new<T>(bufnr: integer) -> T
function Capability.destroy() -> nil
function Capability.on_attach(client_id: integer) -> nil

Callback invoked when an LSP client attaches. Use it to initialize per-client state (empty table, new namespaces, etc.), or issue requests as needed.

function Capability.on_detach(client_id: integer) -> nil

Callback invoked when an LSP client detaches. Use it to clear per-client state (cached data, extmarks, etc.).

function Capability.on_close(client_id: integer)

Callback invoked when textDocument/didClose is sent for a client.

function Capability.on_change(client_id: integer)

Callback invoked when textDocument/didChange or textDocument/didOpen is sent for a client.

function Capability.on_win(topline: integer, botline: integer)

Callback invoked on every redraw.

function Capability.enable(name: vim.lsp.capability.Name, enable: nil | boolean, filter: vim.lsp.capability.enable.Filter | nil) -> nil
function Capability.is_enabled(name: vim.lsp.capability.Name, filter: vim.lsp.capability.enable.Filter | nil) -> any

Fields8

Capability.name : vim.lsp.capability.Name

Static field as the identifier of the LSP capability it supports.

Static field records the method this capability requires.

Capability.active : {integer, vim.lsp.Capability | nil}

Static field for retrieving the instance associated with a specific bufnr.

Index in the form of bufnr -> capability

Capability.bufnr : integer

Buffer number the capability instance is associated with.

Capability.augroup : integer

The augroup owned by this instance, which will be cleared upon destruction.

Capability.client_state : {integer, table}

Per-client state data, scoped to the lifetime of the attached client.

Capability.__index : vim.lsp.Capability