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;
62 bool BundleOverloads =
false;
73 bool EnableInsertReplace =
false;
80 bool ImportInsertions =
false;
84 struct IncludeInsertionIndicator {
85 std::string Insert =
"•";
86 std::string NoInsert =
" ";
90 bool ShowOrigins =
false;
102 bool IncludeFixIts =
false;
109 bool AllScopes =
false;
125 enum CodeCompletionParse {
134 } RunParser = ParseIfReady;
147 enum CodeCompletionRankingModel {
151 static const CodeCompletionRankingModel DefaultRankingModel;
152 CodeCompletionRankingModel RankingModel = DefaultRankingModel;
169 float DecisionForestBase = 1.3f;
175struct CodeCompletion {
181 std::string FilterText;
186 std::string RequiredQualifier;
188 std::string Signature;
190 std::string SnippetSuffix;
192 std::string ReturnType;
194 std::optional<markup::Document> Documentation;
204 unsigned BundleSize = 1;
207 struct IncludeCandidate {
213 std::optional<TextEdit> Insertion;
219 llvm::SmallVector<IncludeCandidate, 1> Includes;
223 std::vector<TextEdit> FixIts;
226 Range CompletionInsertRange;
228 std::optional<Range> CompletionReplaceRange;
239 float ExcludingName = 0.f;
249 float Relevance = 0.f;
254 bool Deprecated =
false;
257 CompletionItem render(
const CodeCompleteOptions &)
const;
259raw_ostream &
operator<<(raw_ostream &,
const CodeCompletion &);
260struct CodeCompleteResult {
261 std::vector<CodeCompletion> Completions;
262 bool HasMore =
false;
263 CodeCompletionContext::Kind Context = CodeCompletionContext::CCC_Other;
269 std::optional<Range> InsertRange;
272 std::optional<Range> ReplaceRange;
275 bool RanParser =
true;
277raw_ostream &
operator<<(raw_ostream &,
const CodeCompleteResult &);
282struct SpeculativeFuzzyFind {
285 std::optional<FuzzyFindRequest> CachedReq;
288 std::optional<FuzzyFindRequest> NewReq;
307 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.