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

Dmitri Gribenko gribozavr at gmail.com
Fri Jun 29 15:44:26 PDT 2012


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).

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-brief-comments-to-code-completion-v2.patch
Type: application/octet-stream
Size: 46485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120629/565080a5/attachment.obj>


More information about the cfe-commits mailing list