}
}
- public class MarkupContent : Object {
+ public class MarkupContent : Object , Json.Serializable {
public string kind { get; set; }
public string value { get; set; }
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")]
}
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<ParameterInformation>();
+
+ 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;
}
}
}
}
- 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 {
{
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; }
public class Hover : Object, Json.Serializable {
public Gee.List<MarkedString> contents { get; set; default = new Gee.ArrayList<MarkedString> (); }
+
public Range range { get; set; }
public new void Json.Serializable.set_property (ParamSpec pspec, Value value) {
return false;
}
var contents = new Gee.ArrayList<MarkedString>();
-
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 );