src/Builder4/Editor.bjs
authorAlan Knowles <alan@roojs.com>
Wed, 20 Mar 2024 15:29:13 +0000 (23:29 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 20 Mar 2024 15:29:13 +0000 (23:29 +0800)
src/Builder4/Editor.vala

src/Builder4/Editor.bjs
src/Builder4/Editor.vala

index e32f43e..bf3f555 100644 (file)
     "(JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)",
     "{",
     "    this.reset();",
+    "    if (this.file != null) {",
+    "    \tthis.file.navigation_tree_updated.disconnect(",
+    "    \t\t_this.navigation.show",
+    "    \t);",
+    "    }",
     "    this.file = file;    ",
-    "    ",
+    "    this.file.navigation_tree_updated.connect(",
+    "\t\t_this.navigation.show",
+    "\t);",
     "    if (file.xtype != \"PlainFile\") {",
     "    \tthis.prop = prop;",
     "        this.node = node;",
     "        this.updateErrorMarks();",
     "        this.close_btn.el.hide();",
     "        var ls = file.getLanguageServer();",
-    "        ls.documentSymbols.begin(file, (a,o) => {",
-    "        \t_this.navigation.show(ls.documentSymbols.end(o)); ",
+    "        ls.queueDocumentSymbols(file);",
+    "        ////ls.documentSymbols.begin(file, (a,o) => {",
+    "        //\t_this.navigation.show(ls.documentSymbols.end(o)); ",
     "        });",
     "        //documentSymbols",
     "        ",
index 11f3fbf..9225fe5 100644 (file)
@@ -138,8 +138,15 @@ public class Editor : Object
        public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
        {
            this.reset();
+           if (this.file != null) {
+               this.file.navigation_tree_updated.disconnect(
+                       _this.navigation.show
+               );
+           }
            this.file = file;    
-           
+           this.file.navigation_tree_updated.connect(
+                       _this.navigation.show
+               );
            if (file.xtype != "PlainFile") {
                this.prop = prop;
                this.node = node;
@@ -157,8 +164,9 @@ public class Editor : Object
                this.updateErrorMarks();
                this.close_btn.el.hide();
                var ls = file.getLanguageServer();
-               ls.documentSymbols.begin(file, (a,o) => {
-                       _this.navigation.show(ls.documentSymbols.end(o)); 
+               ls.queueDocumentSymbols(file);
+               ////ls.documentSymbols.begin(file, (a,o) => {
+               //      _this.navigation.show(ls.documentSymbols.end(o)); 
                });
                //documentSymbols