Nullable enum does not default to null
Nullable enum values seem to default to a value of 0, rather than null. I would expect any nullable type to have a default value of null, even if it is an enum:
[CCode (default_value = "LANGUAGE_SERVER_INSERT_TEXT_FORMAT_PlainText")]
enum InsertTextFormat {
PlainText = 1,
Snippet = 2,
}
class CompletionItem : Object, Gee.Hashable<CompletionItem>, Json.Serializable {
// This version will be serialized as 0, which is unexpected.
// I would expect this to default to either null, or PlainText (via the CCode declaration).
public InsertTextFormat? insertTextFormat { get; set; }
// This version will properly default to null and be omitted from serialization.
public InsertTextFormat? insertTextFormat { get; set; default = null; }
}
Context: https://github.com/benwaffle/vala-language-server/pull/148
Edited by Damien Radtke