mirror of
https://github.com/neovim/neovim.git
synced 2026-08-29 18:41:48 +00:00
docs: lsp.CodeActionContext, nested @inlinedoc
- fix https://github.com/neovim/neovim/issues/39208 - fix generation of neste `@inlinedoc` classes
This commit is contained in:
@@ -1480,15 +1480,15 @@ code_action({opts}) *vim.lsp.buf.code_action()*
|
||||
|
||||
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.
|
||||
• {context}? (`table`) Corresponds to `lsp.CodeActionContext`,
|
||||
but all fields are optional:
|
||||
• {diagnostics}? (`lsp.Diagnostic[]`) Inferred from the
|
||||
current position if not provided.
|
||||
• {only}? (`lsp.CodeActionKind[]`) `CodeActionKind`s used to
|
||||
filter the code actions. Most servers support values like
|
||||
"refactor" or "quickfix".
|
||||
• {triggerKind}? (`lsp.CodeActionTriggerKind`) Why code
|
||||
actions were requested.
|
||||
• {filter}?
|
||||
(`fun(x: lsp.CodeAction|lsp.Command, client_id: integer):boolean`)
|
||||
Predicate taking a code action or command and the provider's
|
||||
|
||||
@@ -1125,17 +1125,23 @@ end
|
||||
---@field result? (lsp.Command|lsp.CodeAction)[]
|
||||
---@field context lsp.HandlerContext
|
||||
|
||||
--- Corresponds to `lsp.CodeActionContext`, but all fields are optional:
|
||||
--- @class vim.lsp.buf.code_action.context : lsp.CodeActionContext
|
||||
--- @inlinedoc
|
||||
---
|
||||
--- Inferred from the current position if not provided.
|
||||
--- @field diagnostics? lsp.Diagnostic[]
|
||||
---
|
||||
--- `CodeActionKind`s used to filter the code actions. Most servers support values like "refactor" or "quickfix".
|
||||
--- @field only? lsp.CodeActionKind[]
|
||||
---
|
||||
--- Why code actions were requested.
|
||||
--- @field triggerKind? lsp.CodeActionTriggerKind
|
||||
|
||||
--- @class vim.lsp.buf.code_action.Opts
|
||||
--- @inlinedoc
|
||||
---
|
||||
--- 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.
|
||||
--- @field context? lsp.CodeActionContext
|
||||
--- @field context? vim.lsp.buf.code_action.context
|
||||
---
|
||||
--- Predicate taking a code action or command and the provider's ID.
|
||||
--- If it returns false, the action is filtered out.
|
||||
|
||||
@@ -3,11 +3,12 @@ local M = {}
|
||||
---@class vim.ui.select.Opts
|
||||
---@inlinedoc
|
||||
---
|
||||
--- Text of the prompt. Defaults to `Select one of:`
|
||||
--- Text of the prompt.
|
||||
--- (default: `Select one of:`)
|
||||
---@field prompt? string
|
||||
---
|
||||
--- Function to format an
|
||||
--- individual item from `items`. Defaults to `tostring`.
|
||||
--- Formats an individual item from `items`.
|
||||
--- (default: `tostring`)
|
||||
---@field format_item? fun(item: any):string
|
||||
---
|
||||
--- Function to preview an individual item from `items`.
|
||||
|
||||
@@ -556,6 +556,9 @@ local function get_class(ty, classes)
|
||||
return classes[cty]
|
||||
end
|
||||
|
||||
--- Recursively resolves `@inlinedoc` classes: replaces the type with "table" and expands class
|
||||
--- fields into the object's description.
|
||||
---
|
||||
--- @param obj nvim.luacats.parser.param|nvim.luacats.parser.return|nvim.luacats.parser.field
|
||||
--- @param classes? table<string,nvim.luacats.parser.class>
|
||||
local function inline_type(obj, classes)
|
||||
@@ -610,7 +613,12 @@ local function inline_type(obj, classes)
|
||||
local desc_append = {}
|
||||
for _, f in ipairs(cls.fields) do
|
||||
if not f.access then
|
||||
inline_type(f, classes)
|
||||
local fdesc, default = get_default(f.desc)
|
||||
if fdesc then
|
||||
-- Indent nested list items from recursive inlining.
|
||||
fdesc = fdesc:gsub('\n(%- {)', '\n %1')
|
||||
end
|
||||
local fty = render_type(f.type, nil, default)
|
||||
local fnm = fmt_field_name(f.name)
|
||||
table.insert(desc_append, table.concat({ '-', fnm, fty, fdesc }, ' '))
|
||||
|
||||
Reference in New Issue
Block a user