From: Alan Knowles Date: Tue, 26 Mar 2024 16:25:31 +0000 (+0800) Subject: Fix #8107 - use lsp hover to provide context bar at top (next step help provider) X-Git-Url: http://git.roojs.org/?p=roobuilder;a=commitdiff_plain;h=158df6b8727a5e4c887ef655789a6e86324ceec0 Fix #8107 - use lsp hover to provide context bar at top (next step help provider) --- diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index ebadf15db..8bb5e4037 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -25,21 +25,29 @@ { "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", + "bool resize_end_child" : false, + "bool resize_start_child" : false, + "bool shrink_end_child" : false, + "bool shrink_start_child" : false, + "id" : "paned", "items" : [ { "$ xns" : "Gtk", "* prop" : "start_child", "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", + "bool hexpand" : true, "int spacing" : 0, "items" : [ { "$ homogeneous" : false, "$ xns" : "Gtk", "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL", - "bool hexpand" : true, + "bool hexpand" : false, + "bool vexpand" : false, "items" : [ { "$ xns" : "Gtk", + "bool vexpand" : true, "id" : "save_button", "label" : "Save", "listeners" : { @@ -54,8 +62,68 @@ }, { "$ xns" : "Gtk", + "Gtk.Justification justify" : "Gtk.Justification.LEFT", "bool hexpand" : true, - "xtype" : "Label" + "float xalign" : 0, + "id" : "helper", + "int margin_end" : 4, + "int margin_start" : 4, + "listeners" : { + "query_tooltip" : [ + "(x, y, keyboard_tooltip, tooltip) => {", + "\tGLib.debug(\"using quiery tooltip?\");", + "\tvar lbl = new Gtk.Label(this.el.tooltip_markup);", + "\tlbl.width_request = 500;", + "\ttooltip.set_custom(lbl);", + "", + "\treturn true;", + "}", + "" + ] + }, + "xtype" : "Label", + "| void setHelp" : [ + "(Lsp.Hover? help) {", + "\tif (help == null || help.contents == null", + "\t\t|| help.contents.size < 1) {", + "\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", + "\t\tswitch(sig[i]) {", + "\t\t\tcase \"public\":", + "\t\t\tcase \"private\":", + "\t\t\tcase \"protected\":", + "\t\t\tcase \"async\":", + "\t\t\tcase \"class\":", + "\t\t\tcase \"{\":", + "\t\t\tcase \"}\":", + "\t\t\tcase \"(\":", + "\t\t\tcase \")\":", + "\t\t\t", + "\t\t\t\tstr += sig[i];", + "\t\t\t\tcontinue;", + "\t\t\t\t", + "\t\t\t\t", + "\t\t\tdefault:", + "\t", + "\t\t\t\tstr += (\"\" + ", + "\t\t\t\t\tGLib.Markup.escape_text(sig[i])", + "\t\t\t\t\t+\"\");", + "\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}", + "\t", + "\tthis.el.set_markup(string.joinv(\" \",str));", + "\t", + "}" + ] }, { "$ xns" : "Gtk", @@ -77,11 +145,12 @@ "}", "" ], + "Gtk.Align halign" : "Gtk.Align.END", "bool draw_value" : false, "bool has_origin" : true, "bool sensitive" : true, "int digits" : 0, - "int width_request" : 200, + "int width_request" : 150, "listeners" : { "change_value" : [ "(st, val ) => {", @@ -97,6 +166,7 @@ }, { "$ xns" : "Gtk", + "Gtk.Align halign" : "Gtk.Align.END", "id" : "close_btn", "items" : [ { @@ -275,7 +345,7 @@ "\t\t\t(uint)iter.get_line(),", "\t\t\t(uint)iter.get_line_offset()", "\t\t);", - "", + "\tthis.showHelp(iter);", "", "}", "" @@ -494,6 +564,49 @@ " return ret;", "}", " " + ], + "| void showHelp" : [ + "(Gtk.TextIter iter) {", + "\tvar back = iter.copy();", + "\tback.backward_char();", + "\t", + "\tvar forward = iter.copy();", + "\tforward.forward_char();", + "\t", + "\t// what's the character at the iter?", + "\tvar str = back.get_text(iter);", + "\tstr += iter.get_text(forward);", + "\tif (str.strip().length < 1) {", + "\t\treturn;", + "\t}", + "\tvar offset = iter.get_line_offset();", + "\tvar line = iter.get_line();", + "\tif (_this.prop != null) {", + "\t\t\t\t// ", + "\t\tline += _this.prop.start_line ; ", + "\t\t\t\t\t// this is based on Gtk using tabs (hence 1/2 chars);", + "\t\toffset += _this.node.node_pad.length;", + "\t\t\t\t\t// javascript listeners are indented 2 more spaces.", + "\t\tif (_this.prop.ptype == JsRender.NodePropType.LISTENER) {", + "\t\t\toffset += 2;", + "\t\t}", + "\t} ", + "\t", + "\tvar ls = _this.file.getLanguageServer();", + "\tls.hover.begin(", + "\t\t_this.file, line, offset,", + "\t\t( a, o) => {", + "\t\t\ttry {", + "\t\t\t\tvar res = ls.hover.end(o );", + "\t\t\t", + "\t\t\t\t_this.helper.setHelp(res);", + "\t\t\t} catch (GLib.Error e) {", + "\t\t\t\t// noop..", + "\t\t\t}", + "\t\t});", + "}\t", + "\t\t ", + "" ] }, { @@ -596,6 +709,33 @@ }, { "$ xns" : "Gtk", + "listeners" : { + "pressed" : [ + "(n_press, x, y) => {", + "\tGtk.TextIter iter;", + "\tint buffer_x, buffer_y;", + "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);", + "\t", + "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,", + "\t\t(int)x - gut.get_width(), (int)y,", + " \t\tout buffer_x, out buffer_y);", + "\t_this.view.el.get_iter_at_location (out iter, ", + "\t\t\tbuffer_x, buffer_y);;", + "\t", + "\t", + "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||", + "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")", + "\t) { ", + "\t\treturn ;", + "\t}", + "\t_this.buffer.showHelp(iter);", + "\t ", + "\t\t ", + " ", + "}", + "" + ] + }, "xtype" : "GestureClick" } ], @@ -938,7 +1078,10 @@ "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "bool hexpand" : true, "bool vexpand" : true, + "bool visible" : false, + "id" : "navigation_holder", "int spacing" : 0, + "int width_request" : 120, "items" : [ { "$ xns" : "Gtk", @@ -950,7 +1093,7 @@ "$ xns" : "Gtk", "bool hexpand" : true, "bool vexpand" : true, - "bool visible" : false, + "bool visible" : true, "id" : "navigationwindow", "items" : [ { @@ -1334,7 +1477,12 @@ ], "| void show" : [ "(Gee.ArrayList syms) {", - "\t_this.navigationwindow.el.show();", + "\t", + "\tif (!_this.navigation_holder.el.visible) {", + "\t\t_this.navigation_holder.el.show();", + "\t\t_this.paned.el.position = ", + "\t\t\t_this.paned.el.get_width() - 200;", + "\t}", "\t//_this.navliststore.el.remove_all();", "\t", "\t", diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 742a21214..ad50296fc 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -12,7 +12,9 @@ public class Editor : Object } return _Editor; } + public Xcls_paned paned; public Xcls_save_button save_button; + public Xcls_helper helper; public Xcls_close_btn close_btn; public Xcls_RightEditor RightEditor; public Xcls_view view; @@ -26,6 +28,7 @@ public class Editor : Object public Xcls_case_sensitive case_sensitive; public Xcls_regex regex; public Xcls_multiline multiline; + public Xcls_navigation_holder navigation_holder; public Xcls_navigationwindow navigationwindow; public Xcls_navigation navigation; public Xcls_navigationselmodel navigationselmodel; @@ -69,9 +72,8 @@ public class Editor : Object this.el.homogeneous = false; this.el.hexpand = true; this.el.vexpand = true; - var child_1 = new Xcls_Paned1( _this ); - child_1.ref(); - this.el.append( child_1.el ); + new Xcls_paned( _this ); + this.el.append( _this.paned.el ); } // user defined functions @@ -400,7 +402,7 @@ public class Editor : Object return false; }); } - public class Xcls_Paned1 : Object + public class Xcls_paned : Object { public Gtk.Paned el; private Editor _this; @@ -409,20 +411,24 @@ public class Editor : Object // my vars (def) // ctor - public Xcls_Paned1(Editor _owner ) + public Xcls_paned(Editor _owner ) { _this = _owner; + _this.paned = this; this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL ); // my vars (dec) // set gobject values + this.el.resize_start_child = false; + this.el.shrink_end_child = false; + this.el.resize_end_child = false; + this.el.shrink_start_child = false; var child_1 = new Xcls_Box2( _this ); child_1.ref(); this.el.start_child = child_1.el; - var child_2 = new Xcls_Box27( _this ); - child_2.ref(); - this.el.end_child = child_2.el; + new Xcls_navigation_holder( _this ); + this.el.end_child = _this.navigation_holder.el; } // user defined functions @@ -444,6 +450,7 @@ public class Editor : Object // my vars (dec) // set gobject values + this.el.hexpand = true; var child_1 = new Xcls_Box3( _this ); child_1.ref(); this.el.append( child_1.el ); @@ -474,12 +481,12 @@ public class Editor : Object // set gobject values this.el.homogeneous = false; - this.el.hexpand = true; + this.el.hexpand = false; + this.el.vexpand = false; new Xcls_save_button( _this ); this.el.append( _this.save_button.el ); - var child_2 = new Xcls_Label5( _this ); - child_2.ref(); - this.el.append( child_2.el ); + new Xcls_helper( _this ); + this.el.append( _this.helper.el ); var child_3 = new Xcls_Scale6( _this ); child_3.ref(); this.el.append( child_3.el ); @@ -507,6 +514,7 @@ public class Editor : Object // my vars (dec) // set gobject values + this.el.vexpand = true; this.el.label = "Save"; //listeners @@ -518,7 +526,7 @@ public class Editor : Object // user defined functions } - public class Xcls_Label5 : Object + public class Xcls_helper : Object { public Gtk.Label el; private Editor _this; @@ -527,18 +535,73 @@ public class Editor : Object // my vars (def) // ctor - public Xcls_Label5(Editor _owner ) + public Xcls_helper(Editor _owner ) { _this = _owner; + _this.helper = this; this.el = new Gtk.Label( null ); // my vars (dec) // set gobject values + this.el.margin_end = 4; + this.el.margin_start = 4; + this.el.justify = Gtk.Justification.LEFT; this.el.hexpand = true; + this.el.xalign = 0f; + + //listeners + this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => { + GLib.debug("using quiery tooltip?"); + var lbl = new Gtk.Label(this.el.tooltip_markup); + lbl.width_request = 500; + tooltip.set_custom(lbl); + + return true; + }); } // user defined functions + public void setHelp (Lsp.Hover? help) { + if (help == null || help.contents == null + || help.contents.size < 1) { + this.el.set_text(""); + return; + } + var sig = help.contents.get(0).value.split(" "); + string[] str = {}; + for(var i =0; i < sig.length; i++) { + + switch(sig[i]) { + case "public": + case "private": + case "protected": + case "async": + case "class": + case "{": + case "}": + case "(": + case ")": + + str += sig[i]; + continue; + + + default: + + str += ("" + + GLib.Markup.escape_text(sig[i]) + +""); + continue; + } + } + if (help.contents.size > 1) { + this.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(1).value); + } + + this.el.set_markup(string.joinv(" ",str)); + + } } public class Xcls_Scale6 : Object @@ -558,8 +621,9 @@ public class Editor : Object // my vars (dec) // set gobject values - this.el.width_request = 200; + this.el.width_request = 150; this.el.has_origin = true; + this.el.halign = Gtk.Align.END; this.el.draw_value = false; this.el.digits = 0; this.el.sensitive = true; @@ -613,6 +677,7 @@ public class Editor : Object // set gobject values this.el.icon_name = "window-close"; + this.el.halign = Gtk.Align.END; var child_1 = new Xcls_Image8( _this ); child_1.ref(); this.el.child = child_1.el; @@ -946,7 +1011,7 @@ public class Editor : Object (uint)iter.get_line(), (uint)iter.get_line_offset() ); - + this.showHelp(iter); }); this.el.changed.connect( () => { @@ -1167,6 +1232,45 @@ public class Editor : Object //print("TO STRING? " + ret); return ret; } + public void showHelp (Gtk.TextIter iter) { + var back = iter.copy(); + back.backward_char(); + + var forward = iter.copy(); + forward.forward_char(); + + // what's the character at the iter? + var str = back.get_text(iter); + str += iter.get_text(forward); + if (str.strip().length < 1) { + return; + } + var offset = iter.get_line_offset(); + var line = iter.get_line(); + if (_this.prop != null) { + // + line += _this.prop.start_line ; + // this is based on Gtk using tabs (hence 1/2 chars); + offset += _this.node.node_pad.length; + // javascript listeners are indented 2 more spaces. + if (_this.prop.ptype == JsRender.NodePropType.LISTENER) { + offset += 2; + } + } + + var ls = _this.file.getLanguageServer(); + ls.hover.begin( + _this.file, line, offset, + ( a, o) => { + try { + var res = ls.hover.end(o ); + + _this.helper.setHelp(res); + } catch (GLib.Error e) { + // noop.. + } + }); + } } public class Xcls_keystate : Object @@ -1312,6 +1416,30 @@ public class Editor : Object // my vars (dec) // set gobject values + + //listeners + this.el.pressed.connect( (n_press, x, y) => { + Gtk.TextIter iter; + int buffer_x, buffer_y; + var gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT); + + _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT, + (int)x - gut.get_width(), (int)y, + out buffer_x, out buffer_y); + _this.view.el.get_iter_at_location (out iter, + buffer_x, buffer_y);; + + + if (_this.buffer.el.iter_has_context_class(iter, "comment") || + _this.buffer.el.iter_has_context_class(iter, "string") + ) { + return ; + } + _this.buffer.showHelp(iter); + + + + }); } // user defined functions @@ -1749,7 +1877,7 @@ public class Editor : Object - public class Xcls_Box27 : Object + public class Xcls_navigation_holder : Object { public Gtk.Box el; private Editor _this; @@ -1758,16 +1886,19 @@ public class Editor : Object // my vars (def) // ctor - public Xcls_Box27(Editor _owner ) + public Xcls_navigation_holder(Editor _owner ) { _this = _owner; + _this.navigation_holder = this; this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 ); // my vars (dec) // set gobject values + this.el.width_request = 120; this.el.hexpand = true; this.el.vexpand = true; + this.el.visible = false; var child_1 = new Xcls_Box28( _this ); child_1.ref(); this.el.append( child_1.el ); @@ -1819,7 +1950,7 @@ public class Editor : Object // set gobject values this.el.hexpand = true; this.el.vexpand = true; - this.el.visible = false; + this.el.visible = true; new Xcls_navigation( _this ); this.el.child = _this.navigation.el; } @@ -1900,7 +2031,12 @@ public class Editor : Object return row; } public void show (Gee.ArrayList syms) { - _this.navigationwindow.el.show(); + + if (!_this.navigation_holder.el.visible) { + _this.navigation_holder.el.show(); + _this.paned.el.position = + _this.paned.el.get_width() - 200; + } //_this.navliststore.el.remove_all(); diff --git a/src/Lsp.vala b/src/Lsp.vala index 97552c115..7b4b7da2e 100644 --- a/src/Lsp.vala +++ b/src/Lsp.vala @@ -833,7 +833,7 @@ namespace Lsp { } } - public class MarkupContent : Object { + public class MarkupContent : Object , Json.Serializable { public string kind { get; set; } public string value { get; set; } @@ -854,6 +854,11 @@ namespace Lsp { this.kind = "markdown"; this.value = doc; } + public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) + { + + return default_deserialize_property (property_name, out value, pspec, property_node); + } } [CCode (default_value = "LSP_COMPLETION_ITEM_KIND_Text")] @@ -953,7 +958,28 @@ namespace Lsp { } public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) { - error ("deserialization not supported"); + //GLib.debug("deserialise property %s" , property_name); + if (property_name != "parameters") { + return default_deserialize_property (property_name, out value, pspec, property_node); + } + value = GLib.Value (typeof(Gee.ArrayList)); + if (property_node.get_node_type () != Json.NodeType.ARRAY) { + // GLib.debug ("unexpected property node type for 'arguments' %s", property_node.get_node_type ().to_string ()); + return false; + } + //GLib.debug("got child length of %d", (int) property_node.get_array ().get_length()); + var arguments = new Gee.ArrayList(); + + property_node.get_array ().foreach_element ((array, index, element) => { + + var add= Json.gobject_deserialize ( typeof (ParameterInformation), array.get_element(index)) as ParameterInformation; + arguments.add( add); + + + }); + + value.set_object (arguments); + return true; } } @@ -979,9 +1005,16 @@ namespace Lsp { } } - public class ParameterInformation : Object { + public class ParameterInformation : Object, Json.Serializable { public string label { get; set; } public MarkupContent documentation { get; set; } + + public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) + { + + return default_deserialize_property (property_name, out value, pspec, property_node); + } + } public class MarkedString : Object { @@ -989,7 +1022,7 @@ namespace Lsp { { this.language = language; this.value = value; - GLib.debug("new marked string %s : %s", language, value); + //GLib.debug("new marked string %s : %s", language, value); } public string language { get; set; } public string value { get; set; } @@ -997,6 +1030,7 @@ namespace Lsp { public class Hover : Object, Json.Serializable { public Gee.List contents { get; set; default = new Gee.ArrayList (); } + public Range range { get; set; } public new void Json.Serializable.set_property (ParamSpec pspec, Value value) { @@ -1037,11 +1071,21 @@ namespace Lsp { return false; } var contents = new Gee.ArrayList(); - property_node.get_array ().foreach_element ((array, index, element) => { + if (element.get_node_type() == Json.NodeType.VALUE) { + var str = element.get_string(); + contents.add ( new MarkedString( "", str )); + + return; + } + if (element.get_node_type() != Json.NodeType.OBJECT) { + GLib.debug("got content: %s", element.get_node_type().to_string()); + return; + } + var add = new MarkedString( - array.get_object_element(index).get_string_member("language"), - array.get_object_element(index).get_string_member("value") + element.get_object().get_string_member("language"), + element.get_object().get_string_member("value") ); contents.add ( add ); diff --git a/src/Palete/LanguageClient.vala b/src/Palete/LanguageClient.vala index 8b97ca0fa..39cbc510e 100644 --- a/src/Palete/LanguageClient.vala +++ b/src/Palete/LanguageClient.vala @@ -74,9 +74,6 @@ namespace Palete { - - - public abstract void initialize_server(); @@ -91,6 +88,7 @@ namespace Palete { public abstract async Lsp.Hover hover (JsRender.JsRender file, int line, int offset) throws GLib.Error; public abstract void queueDocumentSymbols (JsRender.JsRender file); public abstract async Gee.ArrayList documentSymbols (JsRender.JsRender file) throws GLib.Error; + public abstract async Gee.ArrayList signatureHelp (JsRender.JsRender file, int line, int offset) throws GLib.Error; } } diff --git a/src/Palete/LanguageClientDummy.vala b/src/Palete/LanguageClientDummy.vala index 8c1911ab6..400b59ca9 100644 --- a/src/Palete/LanguageClientDummy.vala +++ b/src/Palete/LanguageClientDummy.vala @@ -34,6 +34,10 @@ namespace Palete { var ret = new Gee.ArrayList(); return ret; } + public override async Gee.ArrayList signatureHelp (JsRender.JsRender file, int line, int offset) throws GLib.Error + { + return new Gee.ArrayList(); + } } } \ No newline at end of file diff --git a/src/Palete/LanguageClientJavascript.vala b/src/Palete/LanguageClientJavascript.vala index 876a49c14..0b2772ed7 100644 --- a/src/Palete/LanguageClientJavascript.vala +++ b/src/Palete/LanguageClientJavascript.vala @@ -293,7 +293,11 @@ namespace Palete { var ret = new Gee.ArrayList(); return ret; } - + public override async Gee.ArrayList signatureHelp (JsRender.JsRender file, int line, int offset) throws GLib.Error + { + return new Gee.ArrayList(); + } + } } \ No newline at end of file diff --git a/src/Palete/LanguageClientVala.vala b/src/Palete/LanguageClientVala.vala index e8399fa71..5ae317ec4 100644 --- a/src/Palete/LanguageClientVala.vala +++ b/src/Palete/LanguageClientVala.vala @@ -478,7 +478,7 @@ namespace Palete { }); } - this.countdown = 4; + this.countdown = 2; this.change_queue_file = file; @@ -652,7 +652,7 @@ namespace Palete { public override async Lsp.Hover hover (JsRender.JsRender file, int line, int offset) throws GLib.Error { /* partial_result_token , work_done_token context = null) */ - GLib.debug("get syntax %s", file.relpath); + GLib.debug("get hover %s %d %d", file.relpath, (int)line, (int)offset); var ret = new Lsp.Hover(); //ret = null; if (!this.isReady()) { @@ -676,10 +676,17 @@ namespace Palete { null, out return_value ); + GLib.debug ("LS hover replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true)); + if (return_value == null) { + return ret; + } - - GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true)); var json = Json.gvariant_serialize (return_value); + if (json.get_node_type() != Json.NodeType.OBJECT) { + return ret; + } + + ret = Json.gobject_deserialize ( typeof (Lsp.Hover), json) as Lsp.Hover; return ret; @@ -698,7 +705,7 @@ namespace Palete { }); } - this.doc_countdown = 4; + this.doc_countdown = 2; this.doc_queue_file = file; } @@ -727,7 +734,7 @@ namespace Palete { ); - GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true)); + //GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true)); var json = Json.gvariant_serialize (return_value); @@ -743,7 +750,52 @@ namespace Palete { } - + public override async Gee.ArrayList signatureHelp (JsRender.JsRender file, int line, int offset) throws GLib.Error { + /* partial_result_token , work_done_token context = null) */ + GLib.debug("get signatureHelp %s, %d, %d", file.relpath, line, offset); + var ret = new Gee.ArrayList(); + //ret = null; + if (!this.isReady()) { + return ret; + } + Variant? return_value; + yield this.jsonrpc_client.call_async ( + "textDocument/signatureHelp", + this.buildDict ( + + textDocument : this.buildDict ( ///TextDocumentItem; + uri: new GLib.Variant.string (file.to_url()) + ), + position : this.buildDict ( + line : new GLib.Variant.uint64 ( (uint) line) , + character : new GLib.Variant.uint64 ( uint.max(0, (offset -1))) + ) + + ), + null, + out return_value + ); + + + GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true)); + var json = Json.gvariant_serialize (return_value); + if (json.get_node_type() != Json.NodeType.ARRAY) { + return ret; + } + + + + var ar = json.get_array(); + GLib.debug ("LS replied with %D items", ar.get_length()); + for(var i = 0; i < ar.get_length(); i++ ) { + var add= Json.gobject_deserialize ( typeof (Lsp.SignatureInformation), ar.get_element(i)) as Lsp.SignatureInformation; + ret.add( add); + + } + return ret ; + + + } }