Fix #8120 - more experiments with hover
[roobuilder] / src / Builder4 / Editor.bjs
index 8bb5e40..1c1a75b 100644 (file)
            "int margin_end" : 4,
            "int margin_start" : 4,
            "listeners" : {
+            "activate_link" : [
+             "(uri) => {",
+             "\tGLib.debug(\"got uri %s\", uri);",
+             "\tvar ls = _this.file.getLanguageServer();",
+             "\tls.symbol.begin(uri, (a,b) => {",
+             "\t\tls.symbol.end(b);",
+             "\t});",
+             "\t",
+             "\treturn true;",
+             "}",
+             ""
+            ],
             "query_tooltip" : [
              "(x, y, keyboard_tooltip, tooltip) => {",
              "\tGLib.debug(\"using quiery tooltip?\");",
             "\t\t\t\t",
             "\t\t\tdefault:",
             "\t",
-            "\t\t\t\tstr += (\"<span underline=\\\"single\\\" color=\\\"blue\\\" >\" + ",
+            "\t\t\t\tstr += (\"<a href=\\\"\" + GLib.Markup.escape_text(sig[i]) + \"\\\">\" + ",
             "\t\t\t\t\tGLib.Markup.escape_text(sig[i])",
-            "\t\t\t\t\t+\"</span>\");",
+            "\t\t\t\t\t+\"</a>\");",
             "\t\t\tcontinue;",
             "\t\t}",
             "\t}",
             "\tif (help.contents.size > 1) {",
             "\t\tthis.el.tooltip_markup =  GLib.Markup.escape_text(help.contents.get(1).value);",
+            "\t} else {",
+            "\t\tthis.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(0).value);",
             "\t}",
-            "\t",
             "\tthis.el.set_markup(string.joinv(\" \",str));",
             "\t",
             "}"
             "\t\t_this.navigation_holder.el.show();",
             "\t\t_this.paned.el.position  = ",
             "\t\t\t_this.paned.el.get_width() - 200;",
-            "\t}",
+            "\t} ",
             "\t//_this.navliststore.el.remove_all();",
             "\t",
             "\t",
             "\tforeach(var sym in syms) {",
             "\t\tls.append(sym);",
             "\t}",
+            "\t// if syms updated is empty, but we already have one..",
+            "\tif (_this.navliststore.el.get_n_items() > 0 && ls.get_n_items() < 1) {",
+            "\t\treturn;",
+            "\t}",
             "\tLsp.DocumentSymbol.copyList(ls, _this.navliststore.el);",
             "\t//_this.navliststore.el.append(sym);",
             "\tthis.last_selected_line = -1;",