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