clang-tools 19.0.0git
Public Attributes | Static Public Attributes | List of all members
clang::clangd::CodeAction Struct Reference

A code action represents a change that can be performed in code, e.g. More...

#include <Protocol.h>

Public Attributes

std::string title
 A short, human-readable, title for this code action.
 
std::optional< std::string > kind
 The kind of the code action.
 
std::optional< std::vector< Diagnostic > > diagnostics
 The diagnostics that this code action resolves.
 
bool isPreferred = false
 Marks this as a preferred action.
 
std::optional< WorkspaceEditedit
 The workspace edit this code action performs.
 
std::optional< Command > command
 A command this code action executes.
 

Static Public Attributes

static const llvm::StringLiteral QUICKFIX_KIND = "quickfix"
 
static const llvm::StringLiteral REFACTOR_KIND = "refactor"
 
static const llvm::StringLiteral INFO_KIND = "info"
 

Detailed Description

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.

Definition at line 1063 of file Protocol.h.

Member Data Documentation

◆ command

std::optional<Command> clang::clangd::CodeAction::command

A command this code action executes.

If a code action provides an edit and a command, first the edit is executed and then the command.

Definition at line 1089 of file Protocol.h.

Referenced by clang::clangd::toJSON().

◆ diagnostics

std::optional<std::vector<Diagnostic> > clang::clangd::CodeAction::diagnostics

The diagnostics that this code action resolves.

Definition at line 1075 of file Protocol.h.

Referenced by clang::clangd::toJSON().

◆ edit

std::optional<WorkspaceEdit> clang::clangd::CodeAction::edit

The workspace edit this code action performs.

Definition at line 1085 of file Protocol.h.

Referenced by clang::clangd::toJSON().

◆ INFO_KIND

const llvm::StringLiteral clang::clangd::CodeAction::INFO_KIND = "info"
static

Definition at line 1072 of file Protocol.h.

◆ isPreferred

bool clang::clangd::CodeAction::isPreferred = false

Marks this as a preferred action.

Preferred actions are used by the auto fix command and can be targeted by keybindings. A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take.

Definition at line 1082 of file Protocol.h.

Referenced by clang::clangd::toJSON().

◆ kind

std::optional<std::string> clang::clangd::CodeAction::kind

The kind of the code action.

Used to filter code actions.

Definition at line 1069 of file Protocol.h.

Referenced by clang::clangd::toJSON().

◆ QUICKFIX_KIND

const llvm::StringLiteral clang::clangd::CodeAction::QUICKFIX_KIND = "quickfix"
static

Definition at line 1070 of file Protocol.h.

Referenced by clang::clangd::ClangdServer::codeAction().

◆ REFACTOR_KIND

const llvm::StringLiteral clang::clangd::CodeAction::REFACTOR_KIND = "refactor"
static

Definition at line 1071 of file Protocol.h.

◆ title

std::string clang::clangd::CodeAction::title

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

Definition at line 1065 of file Protocol.h.

Referenced by clang::clangd::toJSON().


The documentation for this struct was generated from the following files: