[cfe-commits] [PATCH] Add brief documentation comments to code completion results

Dmitri Gribenko gribozavr at gmail.com
Mon Jul 2 10:38:44 PDT 2012

On Mon, Jul 2, 2012 at 8:55 AM, Douglas Gregor <dgregor at apple.com> wrote:
> 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,

Thank you for review, committed r159539.

> although we don't need this bit:
> +/*
> +  CodeCompleteConsumer() : OutputIsBinary(false) {
> +    CodeCompleteOpts.IncludeMacros = false;
> +    CodeCompleteOpts.IncludeCodePatterns = false;
> +    IncludeGlobals(true),
> +    IncludeBriefComments(false),
> +  }
> +*/

Removed this comment.

I was checking if anything was relying on the CodeCompleteConsumer
being default constructible, and if so, why those particular option
values are chosen.  (Nothing relied on it.)


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the cfe-commits mailing list