A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code.

A CodeAction must set either edit and/or a command. If both are supplied, the edit is applied first, then the command is executed.

Constructors

Properties

command?: Command

A command this code action executes.

diagnostics?: Diagnostic[]

Diagnostics that this code action resolves.

disabled?: {
    reason: string;
}

Marks that the code action cannot currently be applied.

Type declaration

  • reason: string

A workspace edit this code action performs.

isPreferred?: boolean

Marks this as a preferred action.

Kind of the code action.

Used to filter code actions.

title: string

A short, human-readable, title for this code action.