From f3f5bfb3695d9a248fdeacebbaed496c764dab99 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 26 Mar 2024 23:00:36 +0800 Subject: [PATCH] src/Builder4/Editor.bjs src/Builder4/Editor.vala --- src/Builder4/Editor.bjs | 17 +++++++++++++++-- src/Builder4/Editor.vala | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index 72e1370f1..c79328cc0 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -62,8 +62,21 @@ "int margin_start" : 4, "xtype" : "Label", "| void setHelper" : [ - "() {", - "", + "(Lsp.Hover? help) {", + "\tif (help == null) {", + "\t\tthis.el.set_text(\"\");", + "\t\treturn;", + "\t}", + "\tvar sig = help.contents.get(0).value.split(\" \");", + "\tstring[] str = [];", + "\tfor(var i =0; i < sig.length; i++) {", + "\t\tstr += (\"\" + ", + "\t\t\tGLib.Markup.escape_text(sig[i])", + "\t\t\t+\" \");", + "\t\t\t", + "\t", + "\tthis.el.set_markup(str);", + "\t", "}" ] }, diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 2791a4c26..092486caf 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -544,8 +544,21 @@ public class Editor : Object } // user defined functions - public void setHelper () { - + public void setHelper (Lsp.Hover? help) { + if (help == null) { + this.el.set_text(""); + return; + } + var sig = help.contents.get(0).value.split(" "); + string[] str = []; + for(var i =0; i < sig.length; i++) { + str += ("" + + GLib.Markup.escape_text(sig[i]) + +" "); + + + this.el.set_markup(str); + } } -- 2.39.2