[cfe-commits] [PATCH] Add brief documentation comments to code completion results
Douglas Gregor
dgregor at apple.com
Mon Jul 2 08:55:17 PDT 2012
On Jun 29, 2012, at 3:44 PM, Dmitri Gribenko wrote:
> On Thu, Jun 28, 2012 at 9:29 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> On Jun 28, 2012, at 9:33 AM, Dmitri Gribenko wrote:
>>> The attached patch adds extracted brief comments to code completion
>>> results as informative chunks. I am not sure that this is the right
>>> approach. Maybe a new chunk type is needed.
>>>
>> The "chunks" themselves are typically meant to be rendered as part of the completion text, The brief comments aren't really the same thing, though; they're a separate bit of documentation that would typically be rendered elsewhere. I suggest actually adding an API function
>>
>> CINDEX_LINKAGE CXString clang_getCompletionBriefComment(CXCompletionString completion_string)
>>
>> to extract the comment. Given that extracting these comments isn't free, I recommend adding a bit to CXCodeComplete_Flags to turn on the ability to extract comments.
>
> Attached is the second attempt implementing your proposal.
>
> A new code completion option that enables including brief comments
> into CodeCompletionString should be a, err, code completion option.
> But because ASTUnit caches global declarations during parsing before
> even completion consumer is created, the option is duplicated as a
> translation unit option (in both libclang and ASTUnit, like the option
> to cache code completion results).
This looks great; please feel free to commit, although we don't need this bit:
+/*
+ CodeCompleteConsumer() : OutputIsBinary(false) {
+ CodeCompleteOpts.IncludeMacros = false;
+ CodeCompleteOpts.IncludeCodePatterns = false;
+ IncludeGlobals(true),
+ IncludeBriefComments(false),
+ }
+*/
?
- Doug
More information about the cfe-commits
mailing list