clang-tools 23.0.0git
clang::clangd::CompletionItem Struct Reference

#include <Protocol.h>

Public Attributes

std::string label
 The label of this completion item.
std::optional< CompletionItemLabelDetailslabelDetails
 Additional details for the label.
CompletionItemKind kind = CompletionItemKind::Missing
 The kind of this completion item.
std::string detail
 A human-readable string with additional information about this item, like type or symbol information.
std::optional< MarkupContentdocumentation
 A human-readable string that represents a doc-comment.
std::string sortText
 A string that should be used when comparing this item with other items.
std::string filterText
 A string that should be used when filtering a set of completion items.
std::string insertText
 A string that should be inserted to a document when selecting this completion.
InsertTextFormat insertTextFormat = InsertTextFormat::Missing
 The format of the insert text.
std::optional< std::variant< TextEdit, InsertReplaceEdit > > textEdit
 An edit which is applied to a document when selecting this completion.
std::vector< TextEditadditionalTextEdits
 An optional array of additional text edits that are applied when selecting this completion.
bool deprecated = false
 Indicates if this item is deprecated.
float score = 0.f
 The score that clangd calculates to rank the returned completions.

Detailed Description

Definition at line 1354 of file Protocol.h.

Member Data Documentation

◆ additionalTextEdits

std::vector<TextEdit> clang::clangd::CompletionItem::additionalTextEdits

An optional array of additional text edits that are applied when selecting this completion.

Edits must not overlap with the main edit nor with themselves.

Definition at line 1403 of file Protocol.h.

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

◆ deprecated

bool clang::clangd::CompletionItem::deprecated = false

Indicates if this item is deprecated.

Definition at line 1406 of file Protocol.h.

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

◆ detail

std::string clang::clangd::CompletionItem::detail

A human-readable string with additional information about this item, like type or symbol information.

Definition at line 1368 of file Protocol.h.

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

◆ documentation

std::optional<MarkupContent> clang::clangd::CompletionItem::documentation

A human-readable string that represents a doc-comment.

Definition at line 1371 of file Protocol.h.

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

◆ filterText

std::string clang::clangd::CompletionItem::filterText

A string that should be used when filtering a set of completion items.

When falsy the label is used.

Definition at line 1379 of file Protocol.h.

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

◆ insertText

std::string clang::clangd::CompletionItem::insertText

A string that should be inserted to a document when selecting this completion.

When falsy the label is used.

Definition at line 1383 of file Protocol.h.

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

◆ insertTextFormat

InsertTextFormat clang::clangd::CompletionItem::insertTextFormat = InsertTextFormat::Missing

The format of the insert text.

The format applies to both the insertText property and the newText property of a provided textEdit.

Definition at line 1387 of file Protocol.h.

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

◆ kind

CompletionItemKind clang::clangd::CompletionItem::kind = CompletionItemKind::Missing

The kind of this completion item.

Based of the kind an icon is chosen by the editor.

Definition at line 1364 of file Protocol.h.

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

◆ label

std::string clang::clangd::CompletionItem::label

The label of this completion item.

By default also the text that is inserted when selecting this completion.

Definition at line 1357 of file Protocol.h.

Referenced by clang::clangd::operator<(), clang::clangd::operator<<(), and clang::clangd::toJSON().

◆ labelDetails

std::optional<CompletionItemLabelDetails> clang::clangd::CompletionItem::labelDetails

Additional details for the label.

Definition at line 1360 of file Protocol.h.

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

◆ score

float clang::clangd::CompletionItem::score = 0.f

The score that clangd calculates to rank the returned completions.

This excludes the fuzzy-match between filterText and the partial word. This can be used to re-rank results as the user types, using client-side fuzzy-matching (that score should be multiplied with this one). This is a clangd extension.

Definition at line 1413 of file Protocol.h.

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

◆ sortText

std::string clang::clangd::CompletionItem::sortText

A string that should be used when comparing this item with other items.

When falsy the label is used.

Definition at line 1375 of file Protocol.h.

Referenced by clang::clangd::operator<(), and clang::clangd::toJSON().

◆ textEdit

std::optional<std::variant<TextEdit, InsertReplaceEdit> > clang::clangd::CompletionItem::textEdit

An edit which is applied to a document when selecting this completion.

When an edit is provided insertText is ignored.

Note 1: The text edit's range as well as both ranges from an insert replace edit must be a single line range and must contain the position at which completion has been requested. Note 2: If an InsertReplaceEdit is returned, the edit's insert range must be a prefix of the edit's replace range, meaning it must be contained in and starting at the same position.

Definition at line 1398 of file Protocol.h.

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


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