ide: Assist tips improved

This commit is contained in:
Mirek Fidler 2025-11-28 11:04:13 +01:00
parent 852c88210e
commit d68d8990e8
4 changed files with 13 additions and 7 deletions

View file

@ -603,16 +603,17 @@ bool AssistEditor::DelayedTip(CodeEditor::MouseTip& mt)
return false;
String qtf = "[g ";
if(m.nest.GetCount())
qtf << "[@b* \1" << m.nest << "::\1]&";
String p = m.pretty0;
p.TrimEnd("{}");
qtf << SignatureQtf(m.name, p, m.nest) << '&';
String tl = BestTopic(GetRefLinks(ref_id));
if(tl.GetCount()) {
RichText txt = GetCodeTopic(tl, ref_id);
qtf << AsQTF(txt);
}
else
qtf << SignatureQtf(m.name, m.pretty);
SetQTF(mt, qtf);
mt.background = AdjustIfDark(Color(245, 255, 221));

View file

@ -447,10 +447,11 @@ Vector<ItemTextPart> ParsePretty(const String& name, const String& signature, in
Image CxxIcon(int kind);
String SignatureQtf(const String& name, const String& pretty, int pari)
String SignatureQtf(const String& name, const String& pretty, const String& nest, int pari)
{
String qtf = "[%00-00K ";
Vector<ItemTextPart> n = ParsePretty(name, pretty);
String ns = nest;
for(int i = 0; i < n.GetCount(); i++) {
ItemTextPart& p = n[i];
qtf << "[";
@ -477,6 +478,10 @@ String SignatureQtf(const String& name, const String& pretty, int pari)
break;
}
qtf << ' ';
if(ns.GetCount() && p.type == ITEM_NAME) {
qtf << "[@b \1" << ns << "::\1]";
ns.Clear();
}
qtf << '\1' << pretty.Mid(p.pos, p.len) << '\1';
qtf << ']';
}

View file

@ -25,7 +25,7 @@ void AssistEditor::SyncParamInfo()
int ch = Ch(i++);
if(i > c) {
if(par < mpar) {
qtf = "[A1 " + SignatureQtf(m.item.name, m.item.pretty, pari);
qtf = "[A1 " + SignatureQtf(m.item.name, m.item.pretty, Null, pari);
mpar = par;
pos = m.pos;
}

View file

@ -94,7 +94,7 @@ enum AdditionalKinds {
Image CxxIcon(int kind); // TODO: Move here
int PaintCpp(Draw& w, const Rect& r, int kind, const String& name, const String& pretty, Color ink, bool focuscursor, bool retval_last = false);
String SignatureQtf(const String& name, const String& pretty, int pari = INT_MAX);
String SignatureQtf(const String& name, const String& pretty, const String& nest, int pari = INT_MAX);
String CppText(const String& name, const String& pretty);
bool IsStruct(int kind);