File tree Expand file tree Collapse file tree 2 files changed +41
-11
lines changed Expand file tree Collapse file tree 2 files changed +41
-11
lines changed Original file line number Diff line number Diff line change @@ -1058,20 +1058,24 @@ markup::Document HoverInfo::present() const {
1058
1058
// - `bool param1`
1059
1059
// - `int param2 = 5`
1060
1060
Output.addParagraph ().appendText (" → " ).appendCode (*ReturnType);
1061
- if (Parameters && !Parameters->empty ()) {
1062
- Output.addParagraph ().appendText (" Parameters: " );
1063
- markup::BulletList &L = Output.addBulletList ();
1064
- for (const auto &Param : *Parameters) {
1065
- std::string Buffer;
1066
- llvm::raw_string_ostream OS (Buffer);
1067
- OS << Param;
1068
- L.addItem ().addParagraph ().appendCode (std::move (OS.str ()));
1069
- }
1061
+ }
1062
+
1063
+ if (Parameters && !Parameters->empty ()) {
1064
+ Output.addParagraph ().appendText (" Parameters: " );
1065
+ markup::BulletList &L = Output.addBulletList ();
1066
+ for (const auto &Param : *Parameters) {
1067
+ std::string Buffer;
1068
+ llvm::raw_string_ostream OS (Buffer);
1069
+ OS << Param;
1070
+ L.addItem ().addParagraph ().appendCode (std::move (OS.str ()));
1070
1071
}
1071
- } else if (Type) {
1072
- Output.addParagraph ().appendText (" Type: " ).appendCode (*Type);
1073
1072
}
1074
1073
1074
+ // Don't print Type after Parameters or ReturnType as this will just duplicate
1075
+ // the information
1076
+ if (Type && !ReturnType && !Parameters)
1077
+ Output.addParagraph ().appendText (" Type: " ).appendCode (*Type);
1078
+
1075
1079
if (Value) {
1076
1080
markup::Paragraph &P = Output.addParagraph ();
1077
1081
P.appendText (" Value = " );
Original file line number Diff line number Diff line change @@ -2680,6 +2680,32 @@ public: def)",
2680
2680
2681
2681
// In cls<int>
2682
2682
protected: int method())" ,
2683
+ },
2684
+ {
2685
+ [](HoverInfo &HI) {
2686
+ HI.Definition = " cls(int a, int b = 5)" ;
2687
+ HI.AccessSpecifier = " public" ;
2688
+ HI.Kind = index::SymbolKind::Constructor;
2689
+ HI.NamespaceScope = " " ;
2690
+ HI.LocalScope = " cls" ;
2691
+ HI.Name = " cls" ;
2692
+ HI.Parameters .emplace ();
2693
+ HI.Parameters ->emplace_back ();
2694
+ HI.Parameters ->back ().Type = " int" ;
2695
+ HI.Parameters ->back ().Name = " a" ;
2696
+ HI.Parameters ->emplace_back ();
2697
+ HI.Parameters ->back ().Type = " int" ;
2698
+ HI.Parameters ->back ().Name = " b" ;
2699
+ HI.Parameters ->back ().Default = " 5" ;
2700
+ },
2701
+ R"( constructor cls
2702
+
2703
+ Parameters:
2704
+ - int a
2705
+ - int b = 5
2706
+
2707
+ // In cls
2708
+ public: cls(int a, int b = 5))" ,
2683
2709
},
2684
2710
{
2685
2711
[](HoverInfo &HI) {
You can’t perform that action at this time.
0 commit comments