From d4b57066b86bf65ea30fdb1751b96ef0016cfc18 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Mon, 5 Sep 2022 12:28:22 +0200 Subject: [PATCH] Fixed various things... --- uppsrc/ide/Assist.cpp | 2 -- uppsrc/ide/AssistDisplay.cpp | 2 +- uppsrc/ide/OnlineSearch.cpp | 26 ++++++++++++++++++++------ uppsrc/ide/clang/Visitor.cpp | 15 +++++++++------ uppsrc/ide/clang/done.txt | 6 ++++++ uppsrc/ide/clang/todo.txt | 14 ++++++-------- 6 files changed, 42 insertions(+), 23 deletions(-) diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 76ad86067..2d8678ec6 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -497,8 +497,6 @@ void AssistEditor::PopUpAssist(bool auto_insert) popup.NoZoom(); } type.SetCursor(0); - if(!assist.GetCount()) - return; LTIMING("PopUpAssist2"); int cy = VertLayoutZoom(304); cy += HeaderCtrl::GetStdHeight(); diff --git a/uppsrc/ide/AssistDisplay.cpp b/uppsrc/ide/AssistDisplay.cpp index c2fa8affd..35f1d4bec 100644 --- a/uppsrc/ide/AssistDisplay.cpp +++ b/uppsrc/ide/AssistDisplay.cpp @@ -118,6 +118,6 @@ void AssistEditor::AssistDisplay::Paint(Draw& w, const Rect& r, const Value& q, w.DrawRect(r, paper); - PaintCpp(w, r, m.kind, m.name, m.signature, ink, (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT)); + PaintCpp(w, r, m.kind, m.name, m.signature, ink, (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT), true); } } diff --git a/uppsrc/ide/OnlineSearch.cpp b/uppsrc/ide/OnlineSearch.cpp index 78db25a3a..c7a16f6aa 100644 --- a/uppsrc/ide/OnlineSearch.cpp +++ b/uppsrc/ide/OnlineSearch.cpp @@ -195,11 +195,19 @@ void Ide::OnlineSearchMenu(Bar& menu) { static Time search_engines_tm = Null; static Value search_engines; - - Time h = FileGetTime(SearchEnginesFile()); - if(h != search_engines_tm) { - search_engines = LoadSearchEngines(); - search_engines_tm = h; + static Vector search_icon; + static Vector search_icon_loaded; + static Time next_check = Time::Low(); + + Time ct = GetSysTime(); + if(ct > next_check) { + next_check = ct + 4; + Time h = FileGetTime(SearchEnginesFile()); + if(h != search_engines_tm) { + search_engines = LoadSearchEngines(); + search_engines_tm = h; + search_icon_loaded.Clear(); + } } bool b = editor.IsSelection() || IsAlNum(editor.GetChar()) || editor.GetChar() == '_'; @@ -211,7 +219,13 @@ void Ide::OnlineSearchMenu(Bar& menu) }; auto Icon = [&](int i) { - return StreamRaster::LoadStringAny(Decode64(search_engines[i]["Icon"])); + bool& b = search_icon_loaded.At(i, false); + Image& m = search_icon.At(i); + if(!b) { + b = true; + m = StreamRaster::LoadStringAny(Decode64(search_engines[i]["Icon"])); + } + return m; }; String name, uri; diff --git a/uppsrc/ide/clang/Visitor.cpp b/uppsrc/ide/clang/Visitor.cpp index dc76540c0..d58a971db 100644 --- a/uppsrc/ide/clang/Visitor.cpp +++ b/uppsrc/ide/clang/Visitor.cpp @@ -283,21 +283,22 @@ bool ClangVisitor::ProcessNode(CXCursor cursor) CXCursor ref = clang_getCursorReferenced(cursor); String id = ci.Id(); + int kind = ci.Kind(); if(id.GetCount() && (!locals || dolocals)) { LoadSourceLocation(); CppFileInfo& f = info.GetAdd(sl.path); AnnotationItem& r = locals ? f.locals.Add() : f.items.Add(); - r.kind = ci.Kind(); + r.kind = kind; r.name = ci.Name(); r.type = ci.Type(); r.pos = loc.pos; r.id = id; - r.pretty = ci.Kind() == CXCursor_MacroDefinition ? r.name + r.pretty = kind == CXCursor_MacroDefinition ? r.name : CleanupPretty(FetchString(clang_getCursorPrettyPrinted(cursor, pp_pretty))); r.definition = clang_isCursorDefinition(cursor); r.nspace = ci.Nspace(); r.bases = ci.Bases(); - r.isvirtual = ci.Kind() == CXCursor_CXXMethod && clang_CXXMethod_isVirtual(cursor); + r.isvirtual = kind == CXCursor_CXXMethod && clang_CXXMethod_isVirtual(cursor); if(findarg(r.kind, CXCursor_Constructor, CXCursor_Destructor) >= 0) { int q = r.id.Find('('); if(q >= 0) { @@ -312,7 +313,7 @@ bool ClangVisitor::ProcessNode(CXCursor cursor) r.nest = r.id.Mid(0, q); r.nest.TrimEnd("::"); } - if(IsStruct(ci.Kind())) + if(IsStruct(kind)) MergeWith(r.nest, "::", r.name); } r.uname = ToUpper(r.name); @@ -340,22 +341,24 @@ bool ClangVisitor::ProcessNode(CXCursor cursor) } } - if(findarg(ci.Kind(), CXCursor_FunctionTemplate, CXCursor_FunctionDecl, CXCursor_Constructor, + if(findarg(kind, CXCursor_FunctionTemplate, CXCursor_FunctionDecl, CXCursor_Constructor, CXCursor_Destructor, CXCursor_CXXMethod, CXCursor_ConversionFunction) >= 0) locals = true; - return true; + return findarg(kind, CXCursor_FieldDecl, CXCursor_VarDecl) < 0; } CXChildVisitResult clang_visitor(CXCursor cursor, CXCursor p, CXClientData clientData) { #ifdef DUMPTREE LOGBEGIN(); #endif + LOGBEGIN(); ClangVisitor *v = (ClangVisitor *)clientData; bool bak_locals = v->locals; if(v->ProcessNode(cursor)) clang_visitChildren(cursor, clang_visitor, clientData); v->locals = bak_locals; + LOGEND(); #ifdef DUMPTREE LOGEND(); #endif diff --git a/uppsrc/ide/clang/done.txt b/uppsrc/ide/clang/done.txt index 4edf477df..6d3f2c0ad 100644 --- a/uppsrc/ide/clang/done.txt +++ b/uppsrc/ide/clang/done.txt @@ -1,5 +1,11 @@ DONE: +- Heap leaks in Linux + +- Alt-I on AssistDisplay::Paint + +- Autocomplete Size sz; sz.ct - when the name is not found, list is missing (should not be) + - for .txt file, navigator keeps showing previous local file - ImagePainter iw; iw.Arc - CtrlSpace shows nothing diff --git a/uppsrc/ide/clang/todo.txt b/uppsrc/ide/clang/todo.txt index 9685d8ffe..5a9530fd6 100644 --- a/uppsrc/ide/clang/todo.txt +++ b/uppsrc/ide/clang/todo.txt @@ -86,28 +86,22 @@ ISUES: - Navigator cycling struct AssistEditor : CodeEditor, Navigator { goes to contructor as well -- Handle templates - - Alt-J if everything fails (template, e.g. OpenWindUtil/Utils.h:348), go by the name - - Alt-J relaxed rules if not found (in templates, different parameters) - - Wind/MetMastLayer.cpp:6354 no jump on sqrt (?) - Macros with PPInfo -- Heap leaks in Linux - - Option "first config only" - Option "reindex manual" (autosetup based on CPU cores) - Icons Alt-J/I/U -- Autocomplete Size sz; sz.ct - when the name is not found, list is missing (should not be) - - Occasional freeze probably due to reindexing - void ClearTurbineVarsCache() - after switching main config, reparse file +- Raster/RasterLayer.cpp:841 J on NewRc + NONCLANG: @@ -165,6 +159,10 @@ NTH: - Alt+I should try previous method +- Handle templates + - Alt-J if everything fails (template, e.g. OpenWindUtil/Utils.h:348), go by the name + - Alt-J relaxed rules if not found (in templates, different parameters) + LATER: - optimise hdepend (then maybe remove .h limitation for syncheaders)