summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/CodeCompletionStrings.h
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-06-22 16:11:35 +0000
committerSam McCall <sam.mccall@gmail.com>2018-06-22 16:11:35 +0000
commita68951e37e3df3ba19d9df0dde3bf6353e7109ad (patch)
tree9adea1297fd96e1f65256235157b0924d041e38c /clang-tools-extra/clangd/CodeCompletionStrings.h
parent213cb1b82d3c8e311a4ea45d8c0888b9eb0008da (diff)
downloadbcm5719-llvm-a68951e37e3df3ba19d9df0dde3bf6353e7109ad.tar.gz
bcm5719-llvm-a68951e37e3df3ba19d9df0dde3bf6353e7109ad.zip
[clangd] More precise representation of symbol names/labels in the index.
Summary: Previously, the strings matched LSP completion pretty closely. The completion label was a single string, for instance. This made implementing completion itself easy but makes it hard to use the names in other way, e.g. pretty-printed name in synthesized documentation/hover. It also limits our introspection into completion items, which can only be as precise as the indexed symbols. This change is a prerequisite to improvements to overload bundling which need to inspect e.g. signature structure. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48475 llvm-svn: 335360
Diffstat (limited to 'clang-tools-extra/clangd/CodeCompletionStrings.h')
-rw-r--r--clang-tools-extra/clangd/CodeCompletionStrings.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/clang-tools-extra/clangd/CodeCompletionStrings.h b/clang-tools-extra/clangd/CodeCompletionStrings.h
index fd81db40e76..dac4ba56676 100644
--- a/clang-tools-extra/clangd/CodeCompletionStrings.h
+++ b/clang-tools-extra/clangd/CodeCompletionStrings.h
@@ -45,13 +45,15 @@ getParameterDocComment(const ASTContext &Ctx,
const CodeCompleteConsumer::OverloadCandidate &Result,
unsigned ArgIndex, bool CommentsFromHeaders);
-/// Gets label and insert text for a completion item. For example, for function
-/// `Foo`, this returns <"Foo(int x, int y)", "Foo"> without snippts enabled.
-///
-/// If \p EnableSnippets is true, this will try to use snippet for the insert
-/// text. Otherwise, the insert text will always be plain text.
-void getLabelAndInsertText(const CodeCompletionString &CCS, std::string *Label,
- std::string *InsertText, bool EnableSnippets);
+/// Formats the signature for an item, as a display string and snippet.
+/// e.g. for const_reference std::vector<T>::at(size_type) const, this returns:
+/// *Signature = "(size_type) const"
+/// *Snippet = "(${0:size_type})"
+/// If set, RequiredQualifiers is the text that must be typed before the name.
+/// e.g "Base::" when calling a base class member function that's hidden.
+void getSignature(const CodeCompletionString &CCS, std::string *Signature,
+ std::string *Snippet,
+ std::string *RequiredQualifiers = nullptr);
/// Assembles formatted documentation for a completion result. This includes
/// documentation comments and other relevant information like annotations.
@@ -63,7 +65,7 @@ std::string formatDocumentation(const CodeCompletionString &CCS,
/// Gets detail to be used as the detail field in an LSP completion item. This
/// is usually the return type of a function.
-std::string getDetail(const CodeCompletionString &CCS);
+std::string getReturnType(const CodeCompletionString &CCS);
} // namespace clangd
} // namespace clang
OpenPOWER on IntegriCloud