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;
124 enum CodeCompletionParse {
133 } RunParser = ParseIfReady;
146 enum CodeCompletionRankingModel {
150 static const CodeCompletionRankingModel DefaultRankingModel;
151 CodeCompletionRankingModel RankingModel = DefaultRankingModel;
168 float DecisionForestBase = 1.3f;
174struct CodeCompletion {
180 std::string FilterText;
185 std::string RequiredQualifier;
187 std::string Signature;
189 std::string SnippetSuffix;
191 std::string ReturnType;
193 std::optional<markup::Document> Documentation;
203 unsigned BundleSize = 1;
206 struct IncludeCandidate {
212 std::optional<TextEdit> Insertion;
218 llvm::SmallVector<IncludeCandidate, 1> Includes;
222 std::vector<TextEdit> FixIts;
225 Range CompletionTokenRange;
236 float ExcludingName = 0.f;
246 float Relevance = 0.f;
251 bool Deprecated =
false;
254 CompletionItem render(
const CodeCompleteOptions &)
const;
256raw_ostream &
operator<<(raw_ostream &,
const CodeCompletion &);
257struct CodeCompleteResult {
258 std::vector<CodeCompletion> Completions;
259 bool HasMore =
false;
260 CodeCompletionContext::Kind Context = CodeCompletionContext::CCC_Other;
265 std::optional<Range> CompletionRange;
268 bool RanParser =
true;
270raw_ostream &
operator<<(raw_ostream &,
const CodeCompleteResult &);
275struct SpeculativeFuzzyFind {
278 std::optional<FuzzyFindRequest> CachedReq;
281 std::optional<FuzzyFindRequest> NewReq;
300 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.