[PATCH] D45999: [clangd] Retrieve minimally formatted comment text in completion.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 27 04:17:32 PDT 2018
sammccall added a comment.
My main question/concern is: if these APIs extract/format based on CodeCompletionString and friends, what should our plan be using this this in AST-based features, such as hover?
================
Comment at: clangd/CodeComplete.cpp:259
+ CodeCompletionString *SemaCCS,
+ llvm::StringRef DocComment) const {
assert(bool(SemaResult) == bool(SemaCCS));
----------------
This should probably be SemaDocComment, as this code is all about merging; we want to emphasize sources.
================
Comment at: clangd/CodeComplete.h:48
- /// Add brief comments to completion items, if available.
- /// FIXME(ibiryukov): it looks like turning this option on significantly slows
- /// down completion, investigate if it can be made faster.
----------------
IIUC this fixme no longer applies, because the expensive part was the (eager?) parsing and we no longer do that?
================
Comment at: clangd/CodeCompletionStrings.h:24
+/// Gets a raw documentation comment of \p Result.
+/// Returns empty string when no comment is available.
----------------
What does raw mean - range of the file? indentation stripped?
================
Comment at: clangd/CodeCompletionStrings.h:29
+
+/// Gets a raw documentation comment of the current active parameter
+/// of \p Result.
----------------
"active" is a bit confusing - at this level we just care which arg you're interested in, right?
================
Comment at: clangd/CodeCompletionStrings.h:29
+
+/// Gets a raw documentation comment of the current active parameter
+/// of \p Result.
----------------
sammccall wrote:
> "active" is a bit confusing - at this level we just care which arg you're interested in, right?
Is this typically a substring of getDocComment for the function? If so, noting that would make this clearer.
================
Comment at: clangd/CodeCompletionStrings.h:33
+std::string
+getDocComment(const ASTContext &Ctx,
+ const CodeCompleteConsumer::OverloadCandidate &Result,
----------------
getParameterDocComment?
================
Comment at: clangd/CodeCompletionStrings.h:49
+/// getDocComment functions declared above.
+std::string getDocumentation(const CodeCompletionString &CCS,
+ llvm::StringRef DocComment);
----------------
The name here is confusingly similar to getDocComment, and the comment doesn't really explain how they're different.
Consider calling this formatDocumentation, with a comment like "Assembles formatted documentation for a completion result. This includes documentation comments and other relevant information like annotations."
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D45999
More information about the cfe-commits
mailing list