Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions clang-tools-extra/clangd/Hover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,12 @@ markup::Document HoverInfo::presentDoxygen() const {
SymbolDocCommentVisitor SymbolDoc(Documentation, CommentOpts);

if (SymbolDoc.hasBriefCommand()) {
if (Kind != index::SymbolKind::Parameter &&
Kind != index::SymbolKind::TemplateTypeParm)
// Only add a "Brief" heading if we are not documenting a parameter.
// Parameters only have a brief section and adding the brief header would
// be redundant.
Output.addHeading(3).appendText("Brief");
SymbolDoc.briefToMarkup(Output.addParagraph());
Output.addRuler();
}
Expand All @@ -1550,7 +1556,7 @@ markup::Document HoverInfo::presentDoxygen() const {
// Returns
// `type` - description
if (TemplateParameters && !TemplateParameters->empty()) {
Output.addParagraph().appendBoldText("Template Parameters:");
Output.addHeading(3).appendText("Template Parameters");
markup::BulletList &L = Output.addBulletList();
for (const auto &Param : *TemplateParameters) {
markup::Paragraph &P = L.addItem().addParagraph();
Expand All @@ -1564,7 +1570,7 @@ markup::Document HoverInfo::presentDoxygen() const {
}

if (Parameters && !Parameters->empty()) {
Output.addParagraph().appendBoldText("Parameters:");
Output.addHeading(3).appendText("Parameters");
markup::BulletList &L = Output.addBulletList();
for (const auto &Param : *Parameters) {
markup::Paragraph &P = L.addItem().addParagraph();
Expand All @@ -1583,23 +1589,23 @@ markup::Document HoverInfo::presentDoxygen() const {
if (ReturnType &&
((ReturnType->Type != "void" && !ReturnType->AKA.has_value()) ||
(ReturnType->AKA.has_value() && ReturnType->AKA != "void"))) {
Output.addParagraph().appendBoldText("Returns:");
Output.addHeading(3).appendText("Returns");
markup::Paragraph &P = Output.addParagraph();
P.appendCode(llvm::to_string(*ReturnType));

if (SymbolDoc.hasReturnCommand()) {
P.appendText(" - ");
SymbolDoc.returnToMarkup(P);
}

SymbolDoc.retvalsToMarkup(Output);
Output.addRuler();
}

// add specially handled doxygen commands.
SymbolDoc.warningsToMarkup(Output);
SymbolDoc.notesToMarkup(Output);

// add any other documentation.
SymbolDoc.docToMarkup(Output);
if (SymbolDoc.hasDetailedDoc()) {
Output.addHeading(3).appendText("Details");
SymbolDoc.detailedDocToMarkup(Output);
}

Output.addRuler();

Expand Down
Loading