From a3edf6f59ab5192faa2df6451b4da5789ba9480c Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Sun, 11 Feb 2024 10:50:07 +0800 Subject: [PATCH] fix missing ref on property objects, and skip _ as a suggestion --- src/JsRender/NodeToVala.vala | 10 +++++++++- src/Palete/CompletionProvider.vala | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/JsRender/NodeToVala.vala b/src/JsRender/NodeToVala.vala index b96e8f97d..bd74fe123 100644 --- a/src/JsRender/NodeToVala.vala +++ b/src/JsRender/NodeToVala.vala @@ -347,6 +347,9 @@ public abstract class JsRender.NodeToVala : NodeWriter { prop.start_line = this.cur_line; this.addLine("%s%s%s = %s;".printf(ipad,this.this_el,p,v)); // // %s, iter.get_value().type); + + + prop.end_line = this.cur_line; // got a property.. @@ -389,7 +392,10 @@ public abstract class JsRender.NodeToVala : NodeWriter { // this is only needed if it does not have an ID??? var childname = this.addPropSet(child, child.has("id") ? child.get_prop("id").val : "") ; - + if (!child.has("id")) { + // must ref new objects.. + this.addLine("%s%s.ref();".printf(ipad, childname)); + } if (child.has("* prop")) { @@ -408,6 +414,8 @@ public abstract class JsRender.NodeToVala : NodeWriter { this.ignoreWrapped(child.get_prop("* prop").val); var el_name = this.this_el == "this.el." ? ".el" : ""; + + this.addLine(ipad + this.this_el + child.get_prop("* prop").val + " = " + childname + el_name +";"); continue; diff --git a/src/Palete/CompletionProvider.vala b/src/Palete/CompletionProvider.vala index 223b4d113..5e1a30738 100644 --- a/src/Palete/CompletionProvider.vala +++ b/src/Palete/CompletionProvider.vala @@ -318,7 +318,9 @@ namespace Palete { this.search = word; if (res != null) { foreach(var comp in res.items) { - + if (comp.label == "_") { // skip '_' + continue; + } this.items.add(new CompletionProposal(comp)); } -- 2.39.2