Skip to content

Commit ac529c5

Browse files
committed
Extract doxygen comments in autocompletions
1 parent 38adcdd commit ac529c5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

JsonImpl.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,17 @@ inline json encode(const CodeCompletionString *ccs) {
206206
}
207207

208208
inline json encode(const CodeCompletionResult &cc, const CodeCompletionString *ccs, const SourceManager &sm) {
209-
// TODO: To obtain the complete documentation comment we must
210-
// explore cc.Declaration AST
211-
//cc.Declaration->dump();
212-
213209
json res = json{
214210
{"completion", encode(ccs)}
215211
};
212+
213+
// Extract doxygen comment if available
214+
ASTContext& ast = cc.Declaration->getASTContext();
215+
RawComment* comment = ast.getRawCommentForDeclNoCache(cc.Declaration);
216+
if (comment) {
217+
res["doxy"] = comment->getRawText(sm).str();
218+
}
219+
216220
switch (cc.Kind) {
217221
case CodeCompletionResult::RK_Declaration:
218222
{

0 commit comments

Comments
 (0)