15#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
16#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
28#include "clang/Sema/CodeCompleteConsumer.h"
29#include "clang/Sema/CodeCompleteOptions.h"
30#include "llvm/ADT/SmallVector.h"
31#include "llvm/ADT/StringRef.h"
50 bool EnableSnippets =
false;
54 bool IncludeIneligibleResults =
false;
59 bool ForceLoadPreamble =
false;
65 std::optional<bool> BundleOverloads;
79 bool ImportInsertions =
false;
83 struct IncludeInsertionIndicator {
84 std::string Insert =
"•";
85 std::string NoInsert =
" ";
89 bool ShowOrigins =
false;
101 bool IncludeFixIts =
false;
108 bool AllScopes =
false;
119 enum CodeCompletionParse {
128 } RunParser = ParseIfReady;
141 enum CodeCompletionRankingModel {
145 static const CodeCompletionRankingModel DefaultRankingModel;
146 CodeCompletionRankingModel RankingModel = DefaultRankingModel;
163 float DecisionForestBase = 1.3f;
169struct CodeCompletion {
175 std::string FilterText;
180 std::string RequiredQualifier;
182 std::string Signature;
184 std::string SnippetSuffix;
186 std::string ReturnType;
188 std::optional<markup::Document> Documentation;
198 unsigned BundleSize = 1;
201 struct IncludeCandidate {
207 std::optional<TextEdit> Insertion;
213 llvm::SmallVector<IncludeCandidate, 1> Includes;
217 std::vector<TextEdit> FixIts;
220 Range CompletionTokenRange;
231 float ExcludingName = 0.f;
241 float Relevance = 0.f;
246 bool Deprecated =
false;
249 CompletionItem render(
const CodeCompleteOptions &)
const;
251raw_ostream &
operator<<(raw_ostream &,
const CodeCompletion &);
252struct CodeCompleteResult {
253 std::vector<CodeCompletion> Completions;
254 bool HasMore =
false;
255 CodeCompletionContext::Kind Context = CodeCompletionContext::CCC_Other;
260 std::optional<Range> CompletionRange;
263 bool RanParser =
true;
265raw_ostream &
operator<<(raw_ostream &,
const CodeCompleteResult &);
270struct SpeculativeFuzzyFind {
273 std::optional<FuzzyFindRequest> CachedReq;
276 std::optional<FuzzyFindRequest> NewReq;
295 SpeculativeFuzzyFind *SpecFuzzyFind =
nullptr);
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
An immutable symbol container that stores a set of symbols.
FIXME: Skip testing on windows temporarily due to the different escaping code mode.
CompletionPrefix guessCompletionPrefix(llvm::StringRef Content, unsigned Offset)
CompletionItemKind
The kind of a completion entry.
bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset)
DecisionForestScores evaluateDecisionForest(const SymbolQualitySignals &Quality, const SymbolRelevanceSignals &Relevance, float Base)
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
llvm::StringRef PathRef
A typedef to represent a ref to file path.
CodeCompleteResult codeComplete(PathRef FileName, Position Pos, const PreambleData *Preamble, const ParseInputs &ParseInput, CodeCompleteOptions Opts, SpeculativeFuzzyFind *SpecFuzzyFind)
Gets code completions at a specified Pos in FileName.
SignatureHelp signatureHelp(PathRef FileName, Position Pos, const PreambleData &Preamble, const ParseInputs &ParseInput, MarkupKind DocumentationFormat)
Get signature help at a specified Pos in FileName.
bool isIndexedForCodeCompletion(const NamedDecl &ND, ASTContext &ASTCtx)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Signals derived from a valid AST of a file.
clang::CodeCompleteOptions getClangCompleteOpts() const
Returns options that can be passed to clang's completion engine.
llvm::StringRef Qualifier
ArgumentListsPolicy
controls the completion options for argument lists.
@ FullPlaceholders
full name of both type and variable.
Same semantics as CodeComplete::Score.
The parsed preamble and associated data.
Represents the signature of a callable.
Attributes of a symbol that affect how much we like it.
Attributes of a symbol-query pair that affect how much we like it.