diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 516d0156d..e8f002548 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -286,17 +286,25 @@ void AssistEditor::Assist() Context(parser, GetCursor()); int q = GetCursor(); assist_cursor = q; - while(iscid(Ch(q - 1))) - q--; assist_type.Clear(); assist_item.Clear(); Index in_types; + while(iscid(Ch(q - 1))) + q--; + SkipSpcBack(q); + if(Ch(q - 1) == '(') { + --q; + String id = IdBack(q); + if(id == "THISBACK") + GatherItems(parser.current_scope, false, in_types, false, true); + } + else if(Ch(q - 1) == ':') { while(Ch(q - 1) == ':') q--; Vector tparam; - GatherItems(ParseTemplatedType(Qualify(parser.current_scope, CompleteIdBack(q)), tparam), - true, in_types, true); + String scope = ParseTemplatedType(Qualify(parser.current_scope, CompleteIdBack(q)), tparam); + GatherItems(scope, false, in_types, true, false); } else { String tp; @@ -305,12 +313,12 @@ void AssistEditor::Assist() Index typeset = ExpressionType(parser, xp); for(int i = 0; i < typeset.GetCount(); i++) if(typeset[i].GetCount()) - GatherItems(typeset[i], xp.GetCount() == 0, in_types, xp.GetCount() == 0); + GatherItems(typeset[i], xp.GetCount(), in_types, xp.GetCount() == 0, false); } else { - GatherItems(parser.current_scope, true, in_types, true); + GatherItems(parser.current_scope, true, in_types, true, false); Index in_types2; - GatherItems("", true, in_types2, true); + GatherItems("", false, in_types2, true, false); } } if(assist_item.GetCount() == 0) @@ -381,6 +389,7 @@ void AssistEditor::Complete() f.access = 0; f.kind = 100; } + assist_type.Clear(); PopUpAssist(true); } @@ -490,13 +499,13 @@ bool AssistEditor::Key(dword key, int count) else SyncAssist(); } - else { - if(auto_assist && - (key == '.' || key == '>' && Ch(GetCursor() - 2) == '-' || - key == ':' && Ch(GetCursor() - 2) == ':') && - InCode()) - Assist(); - + else + if(auto_assist && InCode()) { + if(key == '.' || key == '>' && Ch(GetCursor() - 2) == '-' || + key == ':' && Ch(GetCursor() - 2) == ':') + Assist(); + if(key == '(') + Assist(); } if(key == ',') { if(Ch(GetCursor()) == 184) { diff --git a/uppsrc/ide/Cpp.cpp b/uppsrc/ide/Cpp.cpp index 3ce23cb3c..e645197bf 100644 --- a/uppsrc/ide/Cpp.cpp +++ b/uppsrc/ide/Cpp.cpp @@ -229,7 +229,8 @@ int CharFilterT(int c) return c >= '0' && c <= '9' ? "TUVWXYZMNO"[c - '0'] : c; } -void AssistEditor::GatherItems(const String& type, bool nom, Index& in_types, bool tp) +void AssistEditor::GatherItems(const String& type, bool only_public, Index& in_types, bool types, + bool thisback) { LLOG("GatherItems " << type); if(in_types.Find(type) >= 0) { @@ -241,7 +242,7 @@ void AssistEditor::GatherItems(const String& type, bool nom, Index& in_t String ntp = ParseTemplatedType(type, tparam); int q = BrowserBase().Find(ntp); if(q >= 0) { - if(tp) { + if(types) { if(ntp.GetCount()) ntp << "::"; int typei = assist_type.FindAdd(""); @@ -268,8 +269,8 @@ void AssistEditor::GatherItems(const String& type, bool nom, Index& in_t const CppItem& im = n[i]; if(im.IsType()) base = im.qptype; - if((im.IsCode() || im.IsData() || im.IsMacro() && type == "") - && (nom || im.access == PUBLIC)) { + if((im.IsCode() || !thisback && (im.IsData() || im.IsMacro() && type == "")) + && (!only_public || im.access == PUBLIC)) { int q = assist_item.Find(im.name); while(q >= 0) { if(assist_item[q].typei != typei) @@ -281,11 +282,13 @@ void AssistEditor::GatherItems(const String& type, bool nom, Index& in_t (CppItem&)f = im; } } - Vector b = Split(base, ';'); - ResolveTParam(b, tparam); - for(int i = 0; i < b.GetCount(); i++) - if(b[i].GetCount()) - GatherItems(b[i], nom, in_types, tp); + if(!thisback) { + Vector b = Split(base, ';'); + ResolveTParam(b, tparam); + for(int i = 0; i < b.GetCount(); i++) + if(b[i].GetCount()) + GatherItems(b[i], only_public, in_types, types, thisback); + } } in_types.Drop(); } diff --git a/uppsrc/ide/Goto.cpp b/uppsrc/ide/Goto.cpp index 8f3d627b5..e9ed2236c 100644 --- a/uppsrc/ide/Goto.cpp +++ b/uppsrc/ide/Goto.cpp @@ -234,14 +234,17 @@ bool Ide::SwapSIf(const char *cref) if(cref && MakeCodeRef(p.current_scope, p.current_key) != cref) return false; q = FindItem(n, qitem); - int count = GetCount(n, q); - if(q < 0 || count == 1) { - q = FindName(n, p.current_name); - if(q < 0) - return false; - count = GetCount(n, q); - if(count == 1) - return false; + int count = q >= 0 ? GetCount(n, q) : 0; + if(!cref && count < 2) { + for(int i = 0; i < n.GetCount(); i++) { + if(i >= n.GetCount()) + return false; + if(n[i].name == p.current_name) { + GotoCpp(n[i]); + return true; + } + } + return false; } int file = GetCppFileIndex(editfile); int line = p.current.line; diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index de8c1752f..3e5f54ed2 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -425,7 +425,8 @@ struct AssistEditor : CodeEditor { void DCopy(); void Virtuals(); void Thisbacks(); - void GatherItems(const String& type, bool nom, Index& in_types, bool tp); + void GatherItems(const String& type, bool only_public, Index& in_types, + bool types, bool thisback); void SelParam(); int Ch(int q);