clang-tools  14.0.0git
CodeComplete.h
Go to the documentation of this file.
1 //===--- CodeComplete.h ------------------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Code completion provides suggestions for what the user might type next.
10 // After "std::string S; S." we might suggest members of std::string.
11 // Signature help describes the parameters of a function as you type them.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
16 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
17 
18 #include "ASTSignals.h"
19 #include "Compiler.h"
20 #include "Headers.h"
21 #include "Protocol.h"
22 #include "Quality.h"
23 #include "index/Index.h"
24 #include "index/Symbol.h"
25 #include "index/SymbolOrigin.h"
26 #include "support/Logger.h"
27 #include "support/Markup.h"
28 #include "support/Path.h"
29 #include "clang/Sema/CodeCompleteConsumer.h"
30 #include "clang/Sema/CodeCompleteOptions.h"
31 #include "clang/Tooling/CompilationDatabase.h"
32 #include "llvm/ADT/Optional.h"
33 #include "llvm/ADT/SmallVector.h"
34 #include "llvm/ADT/StringRef.h"
35 #include "llvm/Support/Error.h"
36 #include <functional>
37 #include <future>
38 
39 namespace clang {
40 class NamedDecl;
41 namespace clangd {
42 struct PreambleData;
43 struct CodeCompletion;
44 
46  /// Returns options that can be passed to clang's completion engine.
47  clang::CodeCompleteOptions getClangCompleteOpts() const;
48 
49  /// When true, completion items will contain expandable code snippets in
50  /// completion (e.g. `return ${1:expression}` or `foo(${1:int a}, ${2:int
51  /// b})).
52  bool EnableSnippets = false;
53 
54  /// Include results that are not legal completions in the current context.
55  /// For example, private members are usually inaccessible.
57 
58  /// Combine overloads into a single completion item where possible.
59  /// If none, the implementation may choose an appropriate behavior.
60  /// (In practice, ClangdLSPServer enables bundling if the client claims
61  /// to supports signature help).
62  llvm::Optional<bool> BundleOverloads;
63 
64  /// Limit the number of results returned (0 means no limit).
65  /// If more results are available, we set CompletionList.isIncomplete.
66  size_t Limit = 0;
67 
68  /// Whether to present doc comments as plain-text or markdown.
70 
74  } InsertIncludes = IncludeInsertion::IWYU;
75 
76  /// A visual indicator to prepend to the completion label to indicate whether
77  /// completion result would trigger an #include insertion or not.
79  std::string Insert = "•";
80  std::string NoInsert = " ";
82 
83  /// Expose origins of completion items in the label (for debugging).
84  bool ShowOrigins = false;
85 
86  // Populated internally by clangd, do not set.
87  /// If `Index` is set, it is used to augment the code completion
88  /// results.
89  /// FIXME(ioeric): we might want a better way to pass the index around inside
90  /// clangd.
91  const SymbolIndex *Index = nullptr;
92 
93  const ASTSignals *MainFileSignals = nullptr;
94  /// Include completions that require small corrections, e.g. change '.' to
95  /// '->' on member access etc.
96  bool IncludeFixIts = false;
97 
98  /// Whether to generate snippets for function arguments on code-completion.
99  /// Needs snippets to be enabled as well.
101 
102  /// Whether to include index symbols that are not defined in the scopes
103  /// visible from the code completion point. This applies in contexts without
104  /// explicit scope qualifiers.
105  ///
106  /// Such completions can insert scope qualifiers.
107  bool AllScopes = false;
108 
109  /// Whether to use the clang parser, or fallback to text-based completion
110  /// (using identifiers in the current file and symbol indexes).
112  /// Block until we can run the parser (e.g. preamble is built).
113  /// Return an error if this fails.
115  /// Run the parser if inputs (preamble) are ready.
116  /// Otherwise, use text-based completion.
118  /// Always use text-based completion.
121 
122  /// Callback invoked on all CompletionCandidate after they are scored and
123  /// before they are ranked (by -Score). Thus the results are yielded in
124  /// arbitrary order.
125  ///
126  /// This callbacks allows capturing various internal structures used by clangd
127  /// during code completion. Eg: Symbol quality and relevance signals.
128  std::function<void(const CodeCompletion &, const SymbolQualitySignals &,
129  const SymbolRelevanceSignals &, float Score)>
131 
132  /// Model to use for ranking code completion candidates.
137 
138  /// Callback used to score a CompletionCandidate if DecisionForest ranking
139  /// model is enabled.
140  /// This allows us to inject experimental models and compare them with
141  /// baseline model using A/B testing.
142  std::function<DecisionForestScores(
143  const SymbolQualitySignals &, const SymbolRelevanceSignals &, float Base)>
145  /// Weight for combining NameMatch and Prediction of DecisionForest.
146  /// CompletionScore is NameMatch * pow(Base, Prediction).
147  /// The optimal value of Base largely depends on the semantics of the model
148  /// and prediction score (e.g. algorithm used during training, number of
149  /// trees, etc.). Usually if the range of Prediciton is [-20, 20] then a Base
150  /// in [1.2, 1.7] works fine.
151  /// Semantics: E.g. For Base = 1.3, if the Prediciton score reduces by 2.6
152  /// points then completion score reduces by 50% or 1.3^(-2.6).
153  float DecisionForestBase = 1.3f;
154 };
155 
156 // Semi-structured representation of a code-complete suggestion for our C++ API.
157 // We don't use the LSP structures here (unlike most features) as we want
158 // to expose more data to allow for more precise testing and evaluation.
160  // The unqualified name of the symbol or other completion item.
161  std::string Name;
162  // The scope qualifier for the symbol name. e.g. "ns1::ns2::"
163  // Empty for non-symbol completions. Not inserted, but may be displayed.
164  std::string Scope;
165  // Text that must be inserted before the name, and displayed (e.g. base::).
166  std::string RequiredQualifier;
167  // Details to be displayed following the name. Not inserted.
168  std::string Signature;
169  // Text to be inserted following the name, in snippet format.
170  std::string SnippetSuffix;
171  // Type to be displayed for this completion.
172  std::string ReturnType;
173  // The parsed documentation comment.
174  llvm::Optional<markup::Document> Documentation;
176  // This completion item may represent several symbols that can be inserted in
177  // the same way, such as function overloads. In this case BundleSize > 1, and
178  // the following fields are summaries:
179  // - Signature is e.g. "(...)" for functions.
180  // - SnippetSuffix is similarly e.g. "(${0})".
181  // - ReturnType may be empty
182  // - Documentation may be from one symbol, or a combination of several
183  // Other fields should apply equally to all bundled completions.
184  unsigned BundleSize = 1;
186 
188  // The header through which this symbol could be included.
189  // Quoted string as expected by an #include directive, e.g. "<memory>".
190  // Empty for non-symbol completions, or when not known.
191  std::string Header;
192  // Present if Header should be inserted to use this item.
193  llvm::Optional<TextEdit> Insertion;
194  };
195  // All possible include headers ranked by preference. By default, the first
196  // include is used.
197  // If we've bundled together overloads that have different sets of includes,
198  // thse includes may not be accurate for all of them.
199  llvm::SmallVector<IncludeCandidate, 1> Includes;
200 
201  /// Holds information about small corrections that needs to be done. Like
202  /// converting '->' to '.' on member access.
203  std::vector<TextEdit> FixIts;
204 
205  /// Holds the range of the token we are going to replace with this completion.
207 
208  // Scores are used to rank completion items.
209  struct Scores {
210  // The score that items are ranked by.
211  float Total = 0.f;
212 
213  // The finalScore with the fuzzy name match score excluded.
214  // When filtering client-side, editors should calculate the new fuzzy score,
215  // whose scale is 0-1 (with 1 = prefix match, special case 2 = exact match),
216  // and recompute finalScore = fuzzyScore * symbolScore.
217  float ExcludingName = 0.f;
218 
219  // Component scores that contributed to the final score:
220 
221  // Quality describes how important we think this candidate is,
222  // independent of the query.
223  // e.g. symbols with lots of incoming references have higher quality.
224  float Quality = 0.f;
225  // Relevance describes how well this candidate matched the query.
226  // e.g. symbols from nearby files have higher relevance.
227  float Relevance = 0.f;
228  };
230 
231  /// Indicates if this item is deprecated.
232  bool Deprecated = false;
233 
234  // Serialize this to an LSP completion item. This is a lossy operation.
236 };
237 raw_ostream &operator<<(raw_ostream &, const CodeCompletion &);
239  std::vector<CodeCompletion> Completions;
240  bool HasMore = false;
241  CodeCompletionContext::Kind Context = CodeCompletionContext::CCC_Other;
242  // The text that is being directly completed.
243  // Example: foo.pb^ -> foo.push_back()
244  // ~~
245  // Typically matches the textEdit.range of Completions, but not guaranteed to.
246  llvm::Optional<Range> CompletionRange;
247  // Usually the source will be parsed with a real C++ parser.
248  // But heuristics may be used instead if e.g. the preamble is not ready.
249  bool RanParser = true;
250 };
251 raw_ostream &operator<<(raw_ostream &, const CodeCompleteResult &);
252 
253 /// A speculative and asynchronous fuzzy find index request (based on cached
254 /// request) that can be sent before parsing sema. This would reduce completion
255 /// latency if the speculation succeeds.
257  /// A cached request from past code completions.
258  /// Set by caller of `codeComplete()`.
259  llvm::Optional<FuzzyFindRequest> CachedReq;
260  /// The actual request used by `codeComplete()`.
261  /// Set by `codeComplete()`. This can be used by callers to update cache.
262  llvm::Optional<FuzzyFindRequest> NewReq;
263  /// The result is consumed by `codeComplete()` if speculation succeeded.
264  /// NOTE: the destructor will wait for the async call to finish.
265  std::future<SymbolSlab> Result;
266 };
267 
268 /// Gets code completions at a specified \p Pos in \p FileName.
269 ///
270 /// If \p Preamble is nullptr, this runs code completion without compiling the
271 /// code.
272 ///
273 /// If \p SpecFuzzyFind is set, a speculative and asynchronous fuzzy find index
274 /// request (based on cached request) will be run before parsing sema. In case
275 /// the speculative result is used by code completion (e.g. speculation failed),
276 /// the speculative result is not consumed, and `SpecFuzzyFind` is only
277 /// destroyed when the async request finishes.
279  const PreambleData *Preamble,
280  const ParseInputs &ParseInput,
281  CodeCompleteOptions Opts,
282  SpeculativeFuzzyFind *SpecFuzzyFind = nullptr);
283 
284 /// Get signature help at a specified \p Pos in \p FileName.
286  const PreambleData &Preamble,
287  const ParseInputs &ParseInput);
288 
289 // For index-based completion, we only consider:
290 // * symbols in namespaces or translation unit scopes (e.g. no class
291 // members, no locals)
292 // * enum constants in unscoped enum decl (e.g. "red" in "enum {red};")
293 // * primary templates (no specializations)
294 // For the other cases, we let Clang do the completion because it does not
295 // need any non-local information and it will be much better at following
296 // lookup rules. Other symbols still appear in the index for other purposes,
297 // like workspace/symbols or textDocument/definition, but are not used for code
298 // completion.
299 bool isIndexedForCodeCompletion(const NamedDecl &ND, ASTContext &ASTCtx);
300 
301 // Text immediately before the completion point that should be completed.
302 // This is heuristically derived from the source code, and is used when:
303 // - semantic analysis fails
304 // - semantic analysis may be slow, and we speculatively query the index
306  // The unqualified partial name.
307  // If there is none, begin() == end() == completion position.
308  llvm::StringRef Name;
309  // The spelled scope qualifier, such as Foo::.
310  // If there is none, begin() == end() == Name.begin().
311  llvm::StringRef Qualifier;
312 };
313 // Heuristically parses before Offset to determine what should be completed.
314 CompletionPrefix guessCompletionPrefix(llvm::StringRef Content,
315  unsigned Offset);
316 
317 // Whether it makes sense to complete at the point based on typed characters.
318 // For instance, we implicitly trigger at `a->^` but not at `a>^`.
319 bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset);
320 
321 } // namespace clangd
322 } // namespace clang
323 
324 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_CODECOMPLETE_H
clang::clangd::CodeCompleteOptions::RunParser
enum clang::clangd::CodeCompleteOptions::CodeCompletionParse RunParser
Base
std::unique_ptr< GlobalCompilationDatabase > Base
Definition: GlobalCompilationDatabaseTests.cpp:90
Headers.h
clang::clangd::SpeculativeFuzzyFind::NewReq
llvm::Optional< FuzzyFindRequest > NewReq
The actual request used by codeComplete().
Definition: CodeComplete.h:262
clang::clangd::MarkupKind::PlainText
@ PlainText
clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator::Insert
std::string Insert
Definition: CodeComplete.h:79
clang::clangd::CodeCompletion::Scope
std::string Scope
Definition: CodeComplete.h:164
clang::clangd::signatureHelp
SignatureHelp signatureHelp(PathRef FileName, Position Pos, const PreambleData &Preamble, const ParseInputs &ParseInput)
Get signature help at a specified Pos in FileName.
Definition: CodeComplete.cpp:1883
clang::clangd::CodeCompleteResult::Completions
std::vector< CodeCompletion > Completions
Definition: CodeComplete.h:239
SymbolOrigin.h
clang::clangd::CodeCompleteResult::CompletionRange
llvm::Optional< Range > CompletionRange
Definition: CodeComplete.h:246
clang::clangd::CodeCompleteOptions::DecisionForestBase
float DecisionForestBase
Weight for combining NameMatch and Prediction of DecisionForest.
Definition: CodeComplete.h:153
clang::clangd::CodeCompleteResult::HasMore
bool HasMore
Definition: CodeComplete.h:240
clang::clangd::CodeCompleteOptions::ShowOrigins
bool ShowOrigins
Expose origins of completion items in the label (for debugging).
Definition: CodeComplete.h:84
clang::clangd::CodeCompletion::Includes
llvm::SmallVector< IncludeCandidate, 1 > Includes
Definition: CodeComplete.h:199
clang::clangd::CodeCompletion
Definition: CodeComplete.h:159
clang::clangd::CodeCompleteOptions::CodeCompletionParse
CodeCompletionParse
Whether to use the clang parser, or fallback to text-based completion (using identifiers in the curre...
Definition: CodeComplete.h:111
Path.h
clang::clangd::CodeCompleteOptions::InsertIncludes
enum clang::clangd::CodeCompleteOptions::IncludeInsertion InsertIncludes
ParseInput
const ParseInputs & ParseInput
Definition: CodeComplete.cpp:1106
clang::clangd::CompletionPrefix::Name
llvm::StringRef Name
Definition: CodeComplete.h:308
clang::clangd::DecisionForestScores
Same semantics as CodeComplete::Score.
Definition: Quality.h:181
Index.h
Kind
BindArgumentKind Kind
Definition: AvoidBindCheck.cpp:59
clang::clangd::CodeCompleteOptions::ParseIfReady
@ ParseIfReady
Run the parser if inputs (preamble) are ready.
Definition: CodeComplete.h:117
clang::clangd::CodeCompleteOptions::Index
const SymbolIndex * Index
If Index is set, it is used to augment the code completion results.
Definition: CodeComplete.h:91
clang::clangd::CodeCompleteOptions::DecisionForest
@ DecisionForest
Definition: CodeComplete.h:135
clang::clangd::SpeculativeFuzzyFind
A speculative and asynchronous fuzzy find index request (based on cached request) that can be sent be...
Definition: CodeComplete.h:256
clang::clangd::CodeCompletion::Scores::Quality
float Quality
Definition: CodeComplete.h:224
clang::clangd::CodeCompletion::RequiredQualifier
std::string RequiredQualifier
Definition: CodeComplete.h:166
clang::clangd::CodeCompleteOptions::EnableFunctionArgSnippets
bool EnableFunctionArgSnippets
Whether to generate snippets for function arguments on code-completion.
Definition: CodeComplete.h:100
clang::clangd::CodeCompletion::render
CompletionItem render(const CodeCompleteOptions &) const
Definition: CodeComplete.cpp:1955
clang::clangd::SymbolQualitySignals
Attributes of a symbol that affect how much we like it.
Definition: Quality.h:58
clang::clangd::CodeCompletion::Deprecated
bool Deprecated
Indicates if this item is deprecated.
Definition: CodeComplete.h:232
clang::clangd::CodeCompletion::Scores
Definition: CodeComplete.h:209
clang::clangd::CompletionItem
Definition: Protocol.h:1179
clang::clangd::CodeCompleteOptions::AllScopes
bool AllScopes
Whether to include index symbols that are not defined in the scopes visible from the code completion ...
Definition: CodeComplete.h:107
clang::clangd::CodeCompletion::Scores::ExcludingName
float ExcludingName
Definition: CodeComplete.h:217
Preamble
const PreambleData & Preamble
Definition: CodeComplete.cpp:1104
clang::clangd::CodeCompleteOptions::CodeCompletionRankingModel
CodeCompletionRankingModel
Model to use for ranking code completion candidates.
Definition: CodeComplete.h:133
Protocol.h
clang::clangd::CodeCompleteOptions::IncludeIndicator
struct clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator IncludeIndicator
clang::clangd::CompletionPrefix
Definition: CodeComplete.h:305
Offset
size_t Offset
Definition: CodeComplete.cpp:1103
clang::clangd::CodeCompletion::IncludeCandidate::Header
std::string Header
Definition: CodeComplete.h:191
clang::clangd::Position
Definition: Protocol.h:148
clang::clangd::ParseInputs
Information required to run clang, e.g. to parse AST or do code completion.
Definition: Compiler.h:47
clang::clangd::CodeCompleteOptions::IncludeInsertion
IncludeInsertion
Definition: CodeComplete.h:71
clang::clangd::CodeCompletion::CompletionTokenRange
Range CompletionTokenRange
Holds the range of the token we are going to replace with this completion.
Definition: CodeComplete.h:206
clang::clangd::PreambleData
The parsed preamble and associated data.
Definition: Preamble.h:49
clang::clangd::CodeCompletion::FixIts
std::vector< TextEdit > FixIts
Holds information about small corrections that needs to be done.
Definition: CodeComplete.h:203
clang::clangd::CodeCompleteOptions::IncludeIneligibleResults
bool IncludeIneligibleResults
Include results that are not legal completions in the current context.
Definition: CodeComplete.h:56
clang::clangd::CodeCompletion::Signature
std::string Signature
Definition: CodeComplete.h:168
Logger.h
Markup.h
clang::clangd::codeComplete
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.
Definition: CodeComplete.cpp:1860
clang::clangd::CodeCompletion::IncludeCandidate
Definition: CodeComplete.h:187
clang::clangd::CodeCompleteOptions::MainFileSignals
const ASTSignals * MainFileSignals
Definition: CodeComplete.h:93
clang::clangd::evaluateDecisionForest
DecisionForestScores evaluateDecisionForest(const SymbolQualitySignals &Quality, const SymbolRelevanceSignals &Relevance, float Base)
Definition: Quality.cpp:541
clang::clangd::CodeCompleteOptions::IncludeFixIts
bool IncludeFixIts
Include completions that require small corrections, e.g.
Definition: CodeComplete.h:96
clang::clangd::CodeCompleteOptions::NeverParse
@ NeverParse
Always use text-based completion.
Definition: CodeComplete.h:119
clang::clangd::CodeCompleteOptions::BundleOverloads
llvm::Optional< bool > BundleOverloads
Combine overloads into a single completion item where possible.
Definition: CodeComplete.h:62
clang::clangd::SpeculativeFuzzyFind::Result
std::future< SymbolSlab > Result
The result is consumed by codeComplete() if speculation succeeded.
Definition: CodeComplete.h:265
clang::clangd::CodeCompletion::Scores::Relevance
float Relevance
Definition: CodeComplete.h:227
FileName
StringRef FileName
Definition: KernelNameRestrictionCheck.cpp:46
clang::clangd::SymbolOrigin
SymbolOrigin
Definition: SymbolOrigin.h:21
clang::clangd::isIndexedForCodeCompletion
bool isIndexedForCodeCompletion(const NamedDecl &ND, ASTContext &ASTCtx)
Definition: CodeComplete.cpp:1907
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2013
clang::clangd::CompletionItemKind
CompletionItemKind
The kind of a completion entry.
Definition: Protocol.h:286
clang::clangd::CodeCompleteOptions
Definition: CodeComplete.h:45
Symbol.h
ASTSignals.h
clang::clangd::CodeCompleteOptions::RecordCCResult
std::function< void(const CodeCompletion &, const SymbolQualitySignals &, const SymbolRelevanceSignals &, float Score)> RecordCCResult
Callback invoked on all CompletionCandidate after they are scored and before they are ranked (by -Sco...
Definition: CodeComplete.h:130
clang::clangd::CodeCompletion::Scores::Total
float Total
Definition: CodeComplete.h:211
clang::clangd::CodeCompleteOptions::NeverInsert
@ NeverInsert
Definition: CodeComplete.h:73
clang::clangd::allowImplicitCompletion
bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset)
Definition: CodeComplete.cpp:2045
clang::clangd::SymbolIndex
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
Definition: Index.h:111
clang::clangd::CodeCompleteResult::RanParser
bool RanParser
Definition: CodeComplete.h:249
clang::clangd::MarkupKind
MarkupKind
Definition: Protocol.h:387
Compiler.h
clang::clangd::ASTSignals
Signals derived from a valid AST of a file.
Definition: ASTSignals.h:26
clang::clangd::CodeCompletion::SnippetSuffix
std::string SnippetSuffix
Definition: CodeComplete.h:170
clang::clangd::CodeCompleteOptions::RankingModel
enum clang::clangd::CodeCompleteOptions::CodeCompletionRankingModel RankingModel
Score
llvm::Optional< float > Score
Definition: FuzzyMatchTests.cpp:48
clang::clangd::PathRef
llvm::StringRef PathRef
A typedef to represent a ref to file path.
Definition: Path.h:29
clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator::NoInsert
std::string NoInsert
Definition: CodeComplete.h:80
clang::clangd::CodeCompleteOptions::EnableSnippets
bool EnableSnippets
When true, completion items will contain expandable code snippets in completion (e....
Definition: CodeComplete.h:52
clang::clangd::Range
Definition: Protocol.h:177
clang::clangd::SignatureHelp
Represents the signature of a callable.
Definition: Protocol.h:1291
clang::clangd::CodeCompleteResult
Definition: CodeComplete.h:238
clang::clangd::CodeCompleteOptions::AlwaysParse
@ AlwaysParse
Block until we can run the parser (e.g.
Definition: CodeComplete.h:114
clang::clangd::CodeCompletion::Kind
CompletionItemKind Kind
Definition: CodeComplete.h:175
clang::clangd::CodeCompletion::BundleSize
unsigned BundleSize
Definition: CodeComplete.h:184
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::CodeCompleteOptions::DecisionForestScorer
std::function< DecisionForestScores(const SymbolQualitySignals &, const SymbolRelevanceSignals &, float Base)> DecisionForestScorer
Callback used to score a CompletionCandidate if DecisionForest ranking model is enabled.
Definition: CodeComplete.h:144
clang::clangd::CodeCompletion::Documentation
llvm::Optional< markup::Document > Documentation
Definition: CodeComplete.h:174
clang::clangd::CodeCompleteOptions::Limit
size_t Limit
Limit the number of results returned (0 means no limit).
Definition: CodeComplete.h:66
clang::clangd::CodeCompletion::Name
std::string Name
Definition: CodeComplete.h:161
clang::clangd::CodeCompletion::ReturnType
std::string ReturnType
Definition: CodeComplete.h:172
clang::clangd::CodeCompleteOptions::IWYU
@ IWYU
Definition: CodeComplete.h:72
clang::clangd::guessCompletionPrefix
CompletionPrefix guessCompletionPrefix(llvm::StringRef Content, unsigned Offset)
Definition: CodeComplete.cpp:1838
clang::clangd::SymbolOrigin::Unknown
@ Unknown
clang::clangd::CompletionItemKind::Missing
@ Missing
clang::clangd::CodeCompletion::Score
Scores Score
Definition: CodeComplete.h:229
Pos
Position Pos
Definition: SourceCode.cpp:650
clang::clangd::CodeCompleteOptions::Heuristics
@ Heuristics
Definition: CodeComplete.h:134
clang::clangd::CodeCompletion::IncludeCandidate::Insertion
llvm::Optional< TextEdit > Insertion
Definition: CodeComplete.h:193
clang::clangd::CodeCompletion::Origin
SymbolOrigin Origin
Definition: CodeComplete.h:185
Quality.h
clang::clangd::CompletionPrefix::Qualifier
llvm::StringRef Qualifier
Definition: CodeComplete.h:311
clang::clangd::SpeculativeFuzzyFind::CachedReq
llvm::Optional< FuzzyFindRequest > CachedReq
A cached request from past code completions.
Definition: CodeComplete.h:259
clang::clangd::SymbolRelevanceSignals
Attributes of a symbol-query pair that affect how much we like it.
Definition: Quality.h:88
clang::clangd::Context
A context is an immutable container for per-request data that must be propagated through layers that ...
Definition: Context.h:69
clang::clangd::CodeCompleteOptions::getClangCompleteOpts
clang::CodeCompleteOptions getClangCompleteOpts() const
Returns options that can be passed to clang's completion engine.
Definition: CodeComplete.cpp:1818
clang::clangd::CodeCompleteOptions::DocumentationFormat
MarkupKind DocumentationFormat
Whether to present doc comments as plain-text or markdown.
Definition: CodeComplete.h:69
clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator
A visual indicator to prepend to the completion label to indicate whether completion result would tri...
Definition: CodeComplete.h:78