completion provider calling working
authorAlan Knowles <alan@roojs.com>
Sat, 13 Jan 2024 08:17:20 +0000 (16:17 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 13 Jan 2024 08:17:20 +0000 (16:17 +0800)
12 files changed:
src/Application.vala
src/Builder4/DialogFiles.bjs
src/Builder4/DialogFiles.vala
src/Builder4/Editor.bjs
src/Builder4/Editor.vala
src/Builder4/ValaCompileErrors.bjs
src/Builder4/ValaCompileErrors.vala
src/Builder4/WindowLeftTree.bjs
src/Builder4/WindowLeftTree.vala
src/Palete/CompileError.vala
src/Palete/CompletionProvider.vala
src/Palete/LanguageClient.vala

index a3f4b48..8e78b66 100644 (file)
                                        (dom, lvl, msg) => {
 
                                        print("%s: %s : %s\n", (new DateTime.now_local()).format("%H:%M:%S.%f"), lvl.to_string(), msg);
+                                       
+                                       if (dom== "GtkSourceView") { // seems to be some critical wanrings comming from gtksourceview related to insert?
+                                               return;
+                                       }
+                                       if (msg.contains("gdk_popup_present")) { // seems to be problems with the popup present on gtksourceview competion.
+                                               return;
+                                       }
                                        if (BuilderApplication.opt_debug && lvl ==  GLib.LogLevelFlags.LEVEL_CRITICAL) {
                                                GLib.error(msg);
                                        }
index d53a5a2..647b185 100644 (file)
                  " ",
                  "\tvar lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();",
                  "\t   ",
-                 "\tvar item = (JsRender.JsRender)  ((Gtk.ListItem)listitem).get_item();",
+                 "\tvar item = (Project.Project)  ((Gtk.ListItem)listitem).get_item();",
                  "",
                  "\titem.bind_property(\"name\",",
                  "                lbl, \"label\",",
index 36e4387..0d3723b 100644 (file)
                  
                        var lbl = (Gtk.Label)  ((Gtk.ListItem)listitem).get_child();
                           
-                       var item = (JsRender.JsRender)  ((Gtk.ListItem)listitem).get_item();
+                       var item = (Project.Project)  ((Gtk.ListItem)listitem).get_item();
                 
                        item.bind_property("name",
                                 lbl, "label",
index 9fc7e96..8b84ad2 100644 (file)
         "\t",
         " ",
         "\t ",
-        "",
-        "       ",
+        "/*",
+        "this is pretty flakey - triggers Gtk with  < 0 d",
+        " var cp = new GtkSource.CompletionWords(\"test\"); ",
+        " cp.minimum_word_size  = 3;",
+        " //cp.priority = 100; //?? does this do anything",
+        " cp.proposals_batch_size  = 10;",
+        " cp.scan_batch_size = 1000;",
+        " ",
+        "cp.register(_this.buffer.el);",
+        "this.el.completion.add_provider(cp);",
+        "*/",
         "this.el.completion.add_provider(new Palete.CompletionProvider(_this));",
         "  ",
-        "this.el.completion.unblock_interactive();",
+        "//this.el.completion.unblock_interactive();",
         "this.el.completion.select_on_show = true; // select",
-        "//this.el.completion.auto_complete_delay = 500;",
-        "",
         "this.el.completion.remember_info_visibility\t = true;",
         "",
         "",
            "\t\t_this.search_entry.el.grab_focus();",
            "\t    return;",
            "\t}",
-           "    _this.view.el.show_completion();",
+           "    //_this.view.el.show_completion();",
            "   // print(event.key.keyval)",
            "    ",
            "    return;",
index c2e3ce9..2dc57f5 100644 (file)
                        
                  
                         
-                
-                       
+                /*
+                this is pretty flakey - triggers Gtk with  < 0 d
+                 var cp = new GtkSource.CompletionWords("test"); 
+                 cp.minimum_word_size  = 3;
+                 //cp.priority = 100; //?? does this do anything
+                 cp.proposals_batch_size  = 10;
+                 cp.scan_batch_size = 1000;
+                 
+                cp.register(_this.buffer.el);
+                this.el.completion.add_provider(cp);
+                */
                 this.el.completion.add_provider(new Palete.CompletionProvider(_this));
                   
-                this.el.completion.unblock_interactive();
+                //this.el.completion.unblock_interactive();
                 this.el.completion.select_on_show = true; // select
-                //this.el.completion.auto_complete_delay = 500;
-                
                 this.el.completion.remember_info_visibility     = true;
                 
                 
                                _this.search_entry.el.grab_focus();
                            return;
                        }
-                    _this.view.el.show_completion();
+                    //_this.view.el.show_completion();
                    // print(event.key.keyval)
                     
                     return;
index f85d082..5e4aeb3 100644 (file)
                "* prop" : "model",
                "id" : "model",
                "xtype" : "TreeListModel"
+              },
+              {
+               "$ xns" : "Gtk",
+               "* prop" : "sorter",
+               "items" : [
+                {
+                 "$ xns" : "Gtk",
+                 "* prop" : "sorter",
+                 "items" : [
+                  {
+                   "$ xns" : "Gtk",
+                   "* prop" : "expression",
+                   "GLib.Type this_type" : "typeof(Palete.CompileError)",
+                   "string property_name" : "linemsg",
+                   "xtype" : "PropertyExpression"
+                  }
+                 ],
+                 "xtype" : "StringSorter"
+                }
+               ],
+               "xtype" : "TreeListRowSorter"
               }
              ],
              "xtype" : "SortListModel",
                "\t",
                "\t",
                "\t//GLib.debug(\"change  %s to %s\", lbl.label, np.name);",
-               "\tlbl.label = np.line_msg;",
+               "\tlbl.label = np.linemsg;",
                "\t//lbl.tooltip_markup = np.to_property_option_tooltip();",
                "\t ",
                "    expand.set_hide_expander(  np.lines.n_items < 1);",
     "    var  w = win.get_width();",
     "    var h = win.get_height();",
     "",
-    "  ",
-    "     ",
+    "   ",
     "    // left tree = 250, editor area = 500?",
     "    ",
     "    // min 450?",
index cbf532a..baac166 100644 (file)
@@ -89,8 +89,7 @@
             var  w = win.get_width();
             var h = win.get_height();
         
-          
-             
+           
             // left tree = 250, editor area = 500?
             
             // min 450?
                 // set gobject values
                 this.el.hexpand = true;
                 this.el.vexpand = true;
-                var child_2 = new Xcls_ColumnViewColumn8( _this );
+                var child_2 = new Xcls_ColumnViewColumn11( _this );
                 child_2.ref();
                 this.el.append_column ( child_2.el  );
-                var child_3 = new Xcls_GestureClick10( _this );
+                var child_3 = new Xcls_GestureClick13( _this );
                 child_3.ref();
                 this.el.add_controller(  child_3.el );
             }
                 _this = _owner;
                 _this.sortmodel = this;
                 new Xcls_model( _this );
-                this.el = new Gtk.SortListModel( _this.model.el, null );
+                var child_2 = new Xcls_TreeListRowSorter8( _this );
+                child_2.ref();
+                this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
 
                 // my vars (dec)
 
             // user defined functions
         }
 
+        public class Xcls_TreeListRowSorter8 : Object
+        {
+            public Gtk.TreeListRowSorter el;
+            private Xcls_ValaCompileErrors  _this;
+
+
+                // my vars (def)
+
+            // ctor
+            public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
+            {
+                _this = _owner;
+                var child_1 = new Xcls_StringSorter9( _this );
+                child_1.ref();
+                this.el = new Gtk.TreeListRowSorter( child_1.el );
+
+                // my vars (dec)
+
+                // set gobject values
+            }
+
+            // user defined functions
+        }
+        public class Xcls_StringSorter9 : Object
+        {
+            public Gtk.StringSorter el;
+            private Xcls_ValaCompileErrors  _this;
+
+
+                // my vars (def)
+
+            // ctor
+            public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
+            {
+                _this = _owner;
+                var child_1 = new Xcls_PropertyExpression10( _this );
+                child_1.ref();
+                this.el = new Gtk.StringSorter( child_1.el );
+
+                // my vars (dec)
+
+                // set gobject values
+            }
+
+            // user defined functions
+        }
+        public class Xcls_PropertyExpression10 : Object
+        {
+            public Gtk.PropertyExpression el;
+            private Xcls_ValaCompileErrors  _this;
+
+
+                // my vars (def)
+
+            // ctor
+            public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
+            {
+                _this = _owner;
+                this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
+
+                // my vars (dec)
+
+                // set gobject values
+            }
+
+            // user defined functions
+        }
+
+
+
 
 
-        public class Xcls_ColumnViewColumn8 : Object
+        public class Xcls_ColumnViewColumn11 : Object
         {
             public Gtk.ColumnViewColumn el;
             private Xcls_ValaCompileErrors  _this;
                 // my vars (def)
 
             // ctor
-            public Xcls_ColumnViewColumn8(Xcls_ValaCompileErrors _owner )
+            public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
             {
                 _this = _owner;
-                var child_1 = new Xcls_SignalListItemFactory9( _this );
+                var child_1 = new Xcls_SignalListItemFactory12( _this );
                 child_1.ref();
                 this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
 
 
             // user defined functions
         }
-        public class Xcls_SignalListItemFactory9 : Object
+        public class Xcls_SignalListItemFactory12 : Object
         {
             public Gtk.SignalListItemFactory el;
             private Xcls_ValaCompileErrors  _this;
                 // my vars (def)
 
             // ctor
-            public Xcls_SignalListItemFactory9(Xcls_ValaCompileErrors _owner )
+            public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
             {
                 _this = _owner;
                 this.el = new Gtk.SignalListItemFactory();
                        
                        
                        //GLib.debug("change  %s to %s", lbl.label, np.name);
-                       lbl.label = np.line_msg;
+                       lbl.label = np.linemsg;
                        //lbl.tooltip_markup = np.to_property_option_tooltip();
                         
                     expand.set_hide_expander(  np.lines.n_items < 1);
         }
 
 
-        public class Xcls_GestureClick10 : Object
+        public class Xcls_GestureClick13 : Object
         {
             public Gtk.GestureClick el;
             private Xcls_ValaCompileErrors  _this;
                 // my vars (def)
 
             // ctor
-            public Xcls_GestureClick10(Xcls_ValaCompileErrors _owner )
+            public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
             {
                 _this = _owner;
                 this.el = new Gtk.GestureClick();
index 867f892..ae238ab 100644 (file)
            "label" : "Delete Element",
            "listeners" : {
             "clicked" : [
-             "  ( ) => {",
-             "    ",
-             "    print(\"ACTIVATE?\");",
-             "    ",
-             "  \t_this.LeftTreeMenu.el.hide();",
-             "     _this.model.deleteSelected();",
+             " ( ) => {",
+             "_this.LeftTreeMenu.el.hide();",
+             " _this.model.deleteSelected();",
+             "_this.changed();",
              "}"
             ]
            },
index a262dc1..87dadcb 100644 (file)
 
                 //listeners
                 this.el.clicked.connect( ( ) => {
-                    
-                    print("ACTIVATE?");
-                    
-                       _this.LeftTreeMenu.el.hide();
-                     _this.model.deleteSelected();
+                _this.LeftTreeMenu.el.hide();
+                 _this.model.deleteSelected();
+                _this.changed();
                 });
             }
 
index 86ad0f6..ef8fcea 100644 (file)
@@ -97,7 +97,7 @@ namespace Palete {
                                        (this.file.relpath + ":" + this.line.to_string("%09d")); 
                        }
                }
-               public string line_msg {
+               public string linemsg {
                        set {}
                        owned  get {
                                return this.line == -1 ? 
index 9ffa16d..b4b4de5 100644 (file)
@@ -1,5 +1,5 @@
  
-using Gtk;
+//using Gtk;
 
 // not sure why - but extending Gtk.SourceCompletionProvider seems to give an error..
 namespace Palete {
@@ -37,8 +37,8 @@ namespace Palete {
                {
                        GLib.debug("compelte activate");
                        var  p = (CompletionProposal) proposal;
-                       TextMark end_mark = null;
-                       TextIter begin, end;
+                       global::Gtk.TextMark end_mark = null;
+                       global::Gtk.TextIter begin, end;
 
                        if (!context.get_bounds(out begin, out end)) {
                                return;
@@ -110,15 +110,11 @@ namespace Palete {
                }
 
                
-               public  void  populate (GtkSource.CompletionContext context)
-               {
-                       GLib.debug("pupoulate normal");         
-               }
-
-               public  async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
+        
+               internal  async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
                {
                        GLib.debug("pupoulate async");
-                       TextIter begin, end;
+                       global::Gtk.TextIter begin, end;
                        
                        if (context.get_bounds (out begin, out end)) {
                                yield this.file.getLanguageServer().completion(this.file, end.get_line(), end.get_line_offset());
@@ -141,7 +137,7 @@ namespace Palete {
                        var model = in_model;
 
                        var word = context.get_word();
-                       if (model is FilterListModel) { 
+                       if (model is global::Gtk.FilterListModel) { 
                                model = model.get_model ();
                        }
  
@@ -155,10 +151,10 @@ namespace Palete {
                                return;
                        }
                         
-                       var expression = new PropertyExpression(typeof(CompletionProposal), null, "word");
-                       var filter = new StringFilter(expression);
+                       var expression = new global::Gtk.PropertyExpression(typeof(CompletionProposal), null, "word");
+                       var filter = new global::Gtk.StringFilter(expression);
                        filter.set_search( word);
-                       var  filter_model = new FilterListModel(in_model, filter); 
+                       var  filter_model = new global::Gtk.FilterListModel(in_model, filter); 
                        filter_model.set_incremental(true);
                        context.set_proposals_for_provider(this, filter_model); 
                 
index 213e706..23c0f4e 100644 (file)
@@ -120,7 +120,6 @@ namespace Palete {
                                case "textDocument/publishDiagnostics":
                                        this.onDiagnostic(return_value);
                                        return;
-                                       break;
                                default: 
                                        break;