on_list(options)
vim.fn.setqflist({}, ' ', options)
vim.cmd.cfirst()
end
vim.lsp.buf.definition({ on_list = on_list })
vim.lsp.buf.references(nil, { on_list = on_list })
<
• {loclist}? (`boolean`) Whether to use the |location-list| or the
|quickfix| list in the default handler. >lua
vim.lsp.buf.definition({ loclist = true })
vim.lsp.buf.references(nil, { loclist = false })
<
*vim.lsp.LocationOpts*
Extends: |vim.lsp.ListOpts|
Fields: ~
• {reuse_win}? (`boolean`) Jump to existing window if buffer is already
open.
*vim.lsp.LocationOpts.OnList*
Fields: ~
• {items} (`table[]`) Structured like |setqflist-what|
• {title}? (`string`) Title for the list.
• {context}? (`{ bufnr: integer, method: string }`) Subset of `ctx`
from |lsp-handler|.
*vim.lsp.buf.hover.Opts*
Extends: |vim.lsp.util.open_floating_preview.Opts|
Fields: ~
• {silent}? (`boolean`)
*vim.lsp.buf.signature_help.Opts*
Extends: |vim.lsp.util.open_floating_preview.Opts|
Fields: ~
• {silent}? (`boolean`)
*vim.lsp.buf.add_workspace_folder()*
add_workspace_folder({workspace_folder})
Add the folder at path to the workspace folders. If {path} is not
provided, the user will be prompted for a path using |input()|.
Parameters: ~
• {workspace_folder} (`string?`)
clear_references() *vim.lsp.buf.clear_references()*
Removes document highlights from current buffer.
code_action({opts}) *vim.lsp.buf.code_action()*
Selects a code action (LSP: "textDocument/codeAction" request) available
at cursor position.
Parameters: ~
• {opts} (`table?`) A table with the following fields:
• {context}? (`lsp.CodeActionContext`) Corresponds to
`CodeActionContext` of the LSP specification:
• {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred from
the current position if not provided.
• {only}? (`table`) List of LSP `CodeActionKind`s used to
filter the code actions. Most language servers support
values like `refactor` or `quickfix`.
• {triggerKind}? (`integer`) The reason why code actions
were requested.
• {filter}? (`fun(x: lsp.CodeAction|lsp.Command):boolean`)
Predicate taking an `CodeAction` and returning a boolean.
• {apply}? (`boolean`) When set to `true`, and there is just
one remaining action (after filtering), the action is
applied without user query.
• {range}? (`{start: integer[], end: integer[]}`) Range for
which code actions should be requested. If in visual mode
this defaults to the active selection. Table must contain
`start` and `end` keys with {row,col} tuples using mark-like
indexing. See |api-indexing|
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
• vim.lsp.protocol.CodeActionTriggerKind
declaration({opts}) *vim.lsp.buf.declaration()*
Jumps to the declaration of the symbol under the cursor.
Note: ~
• Many servers do not implement this method. Generally, see
|vim.lsp.buf.definition()| instead.
Parameters: ~
• {opts} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
definition({opts}) *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor.
Parameters: