clang-tools  15.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 "Protocol.h"
21 #include "Quality.h"
22 #include "index/Index.h"
23 #include "index/Symbol.h"
24 #include "index/SymbolOrigin.h"
25 #include "support/Markup.h"
26 #include "support/Path.h"
27 #include "clang/Sema/CodeCompleteConsumer.h"
28 #include "clang/Sema/CodeCompleteOptions.h"
29 #include "llvm/ADT/Optional.h"
30 #include "llvm/ADT/SmallVector.h"
31 #include "llvm/ADT/StringRef.h"
32 #include <functional>
33 #include <future>
34 
35 namespace clang {
36 class NamedDecl;
37 namespace clangd {
38 struct PreambleData;
39 struct CodeCompletion;
40 
42  /// Returns options that can be passed to clang's completion engine.
43  clang::CodeCompleteOptions getClangCompleteOpts() const;
44 
45  /// When true, completion items will contain expandable code snippets in
46  /// completion (e.g. `return ${1:expression}` or `foo(${1:int a}, ${2:int
47  /// b})).
48  bool EnableSnippets = false;
49 
50  /// Include results that are not legal completions in the current context.
51  /// For example, private members are usually inaccessible.
53 
54  /// Combine overloads into a single completion item where possible.
55  /// If none, the implementation may choose an appropriate behavior.
56  /// (In practice, ClangdLSPServer enables bundling if the client claims
57  /// to supports signature help).
58  llvm::Optional<bool> BundleOverloads;
59 
60  /// Limit the number of results returned (0 means no limit).
61  /// If more results are available, we set CompletionList.isIncomplete.
62  size_t Limit = 0;
63 
64  /// Whether to present doc comments as plain-text or markdown.
66 
70  } InsertIncludes = IncludeInsertion::IWYU;
71 
72  /// A visual indicator to prepend to the completion label to indicate whether
73  /// completion result would trigger an #include insertion or not.
75  std::string Insert = "•";
76  std::string NoInsert = " ";
78 
79  /// Expose origins of completion items in the label (for debugging).
80  bool ShowOrigins = false;
81 
82  // Populated internally by clangd, do not set.
83  /// If `Index` is set, it is used to augment the code completion
84  /// results.
85  /// FIXME(ioeric): we might want a better way to pass the index around inside
86  /// clangd.
87  const SymbolIndex *Index = nullptr;
88 
89  const ASTSignals *MainFileSignals = nullptr;
90  /// Include completions that require small corrections, e.g. change '.' to
91  /// '->' on member access etc.
92  bool IncludeFixIts = false;
93 
94  /// Whether to generate snippets for function arguments on code-completion.
95  /// Needs snippets to be enabled as well.
97 
98  /// Whether to include index symbols that are not defined in the scopes
99  /// visible from the code completion point. This applies in contexts without
100  /// explicit scope qualifiers.
101  ///
102  /// Such completions can insert scope qualifiers.
103  bool AllScopes = false;
104 
105  /// Whether to use the clang parser, or fallback to text-based completion
106  /// (using identifiers in the current file and symbol indexes).
108  /// Block until we can run the parser (e.g. preamble is built).
109  /// Return an error if this fails.
111  /// Run the parser if inputs (preamble) are ready.
112  /// Otherwise, use text-based completion.
114  /// Always use text-based completion.
117 
118  /// Callback invoked on all CompletionCandidate after they are scored and
119  /// before they are ranked (by -Score). Thus the results are yielded in
120  /// arbitrary order.
121  ///
122  /// This callbacks allows capturing various internal structures used by clangd
123  /// during code completion. Eg: Symbol quality and relevance signals.
124  std::function<void(const CodeCompletion &, const SymbolQualitySignals &,
125  const SymbolRelevanceSignals &, float Score)>
127 
128  /// Model to use for ranking code completion candidates.
133 
134  /// Callback used to score a CompletionCandidate if DecisionForest ranking
135  /// model is enabled.
136  /// This allows us to inject experimental models and compare them with
137  /// baseline model using A/B testing.
138  std::function<DecisionForestScores(
139  const SymbolQualitySignals &, const SymbolRelevanceSignals &, float Base)>
141  /// Weight for combining NameMatch and Prediction of DecisionForest.
142  /// CompletionScore is NameMatch * pow(Base, Prediction).
143  /// The optimal value of Base largely depends on the semantics of the model
144  /// and prediction score (e.g. algorithm used during training, number of
145  /// trees, etc.). Usually if the range of Prediciton is [-20, 20] then a Base
146  /// in [1.2, 1.7] works fine.
147  /// Semantics: E.g. For Base = 1.3, if the Prediciton score reduces by 2.6
148  /// points then completion score reduces by 50% or 1.3^(-2.6).
149  float DecisionForestBase = 1.3f;
150 };
151 
152 // Semi-structured representation of a code-complete suggestion for our C++ API.
153 // We don't use the LSP structures here (unlike most features) as we want
154 // to expose more data to allow for more precise testing and evaluation.
156  // The unqualified name of the symbol or other completion item.
157  std::string Name;
158  // The name of the symbol for filtering and sorting purposes. Typically the
159  // same as `Name`, but may be different e.g. for ObjC methods, `Name` is the
160  // first selector fragment but the `FilterText` is the entire selector.
161  std::string FilterText;
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  MarkupKind DocumentationFormat);
289 
290 // For index-based completion, we only consider:
291 // * symbols in namespaces or translation unit scopes (e.g. no class
292 // members, no locals)
293 // * enum constants in unscoped enum decl (e.g. "red" in "enum {red};")
294 // * primary templates (no specializations)
295 // For the other cases, we let Clang do the completion because it does not
296 // need any non-local information and it will be much better at following
297 // lookup rules. Other symbols still appear in the index for other purposes,
298 // like workspace/symbols or textDocument/definition, but are not used for code
299 // completion.
300 bool isIndexedForCodeCompletion(const NamedDecl &ND, ASTContext &ASTCtx);
301 
302 // Text immediately before the completion point that should be completed.
303 // This is heuristically derived from the source code, and is used when:
304 // - semantic analysis fails
305 // - semantic analysis may be slow, and we speculatively query the index
307  // The unqualified partial name.
308  // If there is none, begin() == end() == completion position.
309  llvm::StringRef Name;
310  // The spelled scope qualifier, such as Foo::.
311  // If there is none, begin() == end() == Name.begin().
312  llvm::StringRef Qualifier;
313 };
314 // Heuristically parses before Offset to determine what should be completed.
315 CompletionPrefix guessCompletionPrefix(llvm::StringRef Content,
316  unsigned Offset);
317 
318 // Whether it makes sense to complete at the point based on typed characters.
319 // For instance, we implicitly trigger at `a->^` but not at `a>^`.
320 bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset);
321 
322 } // namespace clangd
323 } // namespace clang
324 
325 #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:85
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:75
clang::clangd::CodeCompletion::Scope
std::string Scope
Definition: CodeComplete.h:164
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:149
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:80
clang::clangd::CodeCompletion::Includes
llvm::SmallVector< IncludeCandidate, 1 > Includes
Definition: CodeComplete.h:199
clang::clangd::CodeCompletion
Definition: CodeComplete.h:155
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:107
Path.h
clang::clangd::CodeCompleteOptions::InsertIncludes
enum clang::clangd::CodeCompleteOptions::IncludeInsertion InsertIncludes
ParseInput
const ParseInputs & ParseInput
Definition: CodeComplete.cpp:1206
clang::clangd::CompletionPrefix::Name
llvm::StringRef Name
Definition: CodeComplete.h:309
clang::clangd::DecisionForestScores
Same semantics as CodeComplete::Score.
Definition: Quality.h:178
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:113
clang::clangd::CodeCompleteOptions::Index
const SymbolIndex * Index
If Index is set, it is used to augment the code completion results.
Definition: CodeComplete.h:87
clang::clangd::CodeCompleteOptions::DecisionForest
@ DecisionForest
Definition: CodeComplete.h:131
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:96
clang::clangd::CodeCompletion::render
CompletionItem render(const CodeCompleteOptions &) const
Definition: CodeComplete.cpp:2120
clang::clangd::SymbolQualitySignals
Attributes of a symbol that affect how much we like it.
Definition: Quality.h:55
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:1199
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:103
clang::clangd::CodeCompletion::Scores::ExcludingName
float ExcludingName
Definition: CodeComplete.h:217
Pos
size_t Pos
Definition: NoLintDirectiveHandler.cpp:97
clang::clangd::CodeCompleteOptions::CodeCompletionRankingModel
CodeCompletionRankingModel
Model to use for ranking code completion candidates.
Definition: CodeComplete.h:129
Protocol.h
clang::clangd::CodeCompleteOptions::IncludeIndicator
struct clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator IncludeIndicator
clang::clangd::CompletionPrefix
Definition: CodeComplete.h:306
Offset
size_t Offset
Definition: CodeComplete.cpp:1203
clang::clangd::CodeCompletion::IncludeCandidate::Header
std::string Header
Definition: CodeComplete.h:191
clang::clangd::Position
Definition: Protocol.h:153
clang::clangd::ParseInputs
Information required to run clang, e.g. to parse AST or do code completion.
Definition: Compiler.h:46
clang::clangd::CodeCompleteOptions::IncludeInsertion
IncludeInsertion
Definition: CodeComplete.h:67
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:52
clang::clangd::CodeCompletion::Signature
std::string Signature
Definition: CodeComplete.h:168
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:2026
clang::clangd::CodeCompletion::IncludeCandidate
Definition: CodeComplete.h:187
clang::clangd::CodeCompleteOptions::MainFileSignals
const ASTSignals * MainFileSignals
Definition: CodeComplete.h:89
clang::clangd::evaluateDecisionForest
DecisionForestScores evaluateDecisionForest(const SymbolQualitySignals &Quality, const SymbolRelevanceSignals &Relevance, float Base)
Definition: Quality.cpp:533
clang::clangd::CodeCompleteOptions::IncludeFixIts
bool IncludeFixIts
Include completions that require small corrections, e.g.
Definition: CodeComplete.h:92
clang::clangd::CodeCompleteOptions::NeverParse
@ NeverParse
Always use text-based completion.
Definition: CodeComplete.h:115
clang::clangd::CodeCompleteOptions::BundleOverloads
llvm::Optional< bool > BundleOverloads
Combine overloads into a single completion item where possible.
Definition: CodeComplete.h:58
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::isIndexedForCodeCompletion
bool isIndexedForCodeCompletion(const NamedDecl &ND, ASTContext &ASTCtx)
Definition: CodeComplete.cpp:2087
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition: CodeComplete.cpp:2182
clang::clangd::CompletionItemKind
CompletionItemKind
The kind of a completion entry.
Definition: Protocol.h:291
clang::clangd::signatureHelp
SignatureHelp signatureHelp(PathRef FileName, Position Pos, const PreambleData &Preamble, const ParseInputs &ParseInput, MarkupKind DocumentationFormat)
Get signature help at a specified Pos in FileName.
Definition: CodeComplete.cpp:2062
clang::clangd::CodeCompleteOptions
Definition: CodeComplete.h:41
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:126
clang::clangd::CodeCompletion::Scores::Total
float Total
Definition: CodeComplete.h:211
clang::clangd::CodeCompleteOptions::NeverInsert
@ NeverInsert
Definition: CodeComplete.h:69
clang::clangd::allowImplicitCompletion
bool allowImplicitCompletion(llvm::StringRef Content, unsigned Offset)
Definition: CodeComplete.cpp:2214
clang::clangd::CodeCompletion::FilterText
std::string FilterText
Definition: CodeComplete.h:161
clang::clangd::SymbolIndex
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
Definition: Index.h:113
clang::clangd::CodeCompleteResult::RanParser
bool RanParser
Definition: CodeComplete.h:249
clang::clangd::MarkupKind
MarkupKind
Definition: Protocol.h:392
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:47
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:76
clang::clangd::CodeCompleteOptions::EnableSnippets
bool EnableSnippets
When true, completion items will contain expandable code snippets in completion (e....
Definition: CodeComplete.h:48
clang::clangd::Range
Definition: Protocol.h:182
clang::clangd::SignatureHelp
Represents the signature of a callable.
Definition: Protocol.h:1311
clang::clangd::CodeCompleteResult
Definition: CodeComplete.h:238
clang::clangd::CodeCompleteOptions::AlwaysParse
@ AlwaysParse
Block until we can run the parser (e.g.
Definition: CodeComplete.h:110
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:140
clang::clangd::SymbolOrigin
SymbolOrigin
Definition: SymbolOrigin.h:21
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:62
clang::clangd::CodeCompletion::Name
std::string Name
Definition: CodeComplete.h:157
clang::clangd::CodeCompletion::ReturnType
std::string ReturnType
Definition: CodeComplete.h:172
clang::clangd::CodeCompleteOptions::IWYU
@ IWYU
Definition: CodeComplete.h:68
clang::clangd::guessCompletionPrefix
CompletionPrefix guessCompletionPrefix(llvm::StringRef Content, unsigned Offset)
Definition: CodeComplete.cpp:1950
clang::clangd::CompletionItemKind::Missing
@ Missing
clang::clangd::CodeCompletion::Score
Scores Score
Definition: CodeComplete.h:229
clang::clangd::CodeCompleteOptions::Heuristics
@ Heuristics
Definition: CodeComplete.h:130
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:312
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:85
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:1930
clang::clangd::CodeCompleteOptions::DocumentationFormat
MarkupKind DocumentationFormat
Whether to present doc comments as plain-text or markdown.
Definition: CodeComplete.h:65
clang::clangd::CodeCompleteOptions::IncludeInsertionIndicator
A visual indicator to prepend to the completion label to indicate whether completion result would tri...
Definition: CodeComplete.h:74
clang::clangd::SymbolOrigin::Unknown
@ Unknown