completion working wip_alan_T7968_language_server_start origin/wip_alan_T7968_language_server_start
authorAlan Knowles <alan@roojs.com>
Sat, 13 Jan 2024 14:53:07 +0000 (22:53 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 13 Jan 2024 14:53:07 +0000 (22:53 +0800)
src/Application.vala
src/Builder4/Editor.bjs
src/Builder4/Editor.vala
src/Lsp.vala
src/Main.vala
src/Palete/CompletionProvider.vala
src/Palete/Gtk.vala
src/Palete/LanguageClient.vala
src/Palete/Roo.vala

index 8e78b66..41f1c0a 100644 (file)
                                        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 (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 8b84ad2..038d0a7 100644 (file)
@@ -1,6 +1,5 @@
 {
  "build_module" : "builder",
- "gen_extended" : false,
  "items" : [
   {
    "# GtkSource.SearchContext searchcontext" : "null",
         "  ",
         "//this.el.completion.unblock_interactive();",
         "this.el.completion.select_on_show = true; // select",
-        "this.el.completion.remember_info_visibility\t = true;",
+        "//this.el.completion.remember_info_visibility\t = true;",
         "",
         "",
         "var attrs = new GtkSource.MarkAttributes();",
    ]
   }
  ],
- "name" : "Editor"
+ "modOrder" : "",
+ "name" : "Editor",
+ "parent" : "",
+ "path" : "/home/alan/gitlive/roobuilder/src/Builder4/Editor.bjs",
+ "permname" : "",
+ "title" : ""
 }
\ No newline at end of file
index 2dc57f5..c1cca4b 100644 (file)
-    static Editor  _Editor;
+static Editor  _Editor;
 
-    public class Editor : Object
-    {
-        public Gtk.Box el;
-        private Editor  _this;
-
-        public static Editor singleton()
-        {
-            if (_Editor == null) {
-                _Editor= new Editor();
-            }
-            return _Editor;
-        }
-        public Xcls_save_button save_button;
-        public Xcls_close_btn close_btn;
-        public Xcls_RightEditor RightEditor;
-        public Xcls_view view;
-        public Xcls_buffer buffer;
-        public Xcls_search_entry search_entry;
-        public Xcls_search_results search_results;
-        public Xcls_nextBtn nextBtn;
-        public Xcls_backBtn backBtn;
-        public Xcls_search_settings search_settings;
-        public Xcls_case_sensitive case_sensitive;
-        public Xcls_regex regex;
-        public Xcls_multiline multiline;
-
-            // my vars (def)
-        public int pos_root_x;
-        public Xcls_MainWindow window;
-        public bool dirty;
-        public int pos_root_y;
-        public bool pos;
-        public GtkSource.SearchContext searchcontext;
-        public int last_search_end;
-        public signal void save ();
-        public JsRender.JsRender? file;
-        public JsRender.Node node;
-        public JsRender.NodeProp? prop;
-        public string activeEditor;
-
-        // ctor
-        public Editor()
-        {
-            _this = this;
-            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
-            // my vars (dec)
-            this.window = null;
-            this.dirty = false;
-            this.pos = false;
-            this.searchcontext = null;
-            this.last_search_end = 0;
-            this.file = null;
-            this.node = null;
-            this.prop = null;
-            this.activeEditor = "";
+public class Editor : Object
+{
+    public Gtk.Box el;
+    private Editor  _this;
 
-            // set gobject values
-            this.el.homogeneous = false;
-            this.el.hexpand = true;
-            this.el.vexpand = true;
-            var child_1 = new Xcls_Box2( _this );
-            child_1.ref();
-            this.el.append( child_1.el );
-            new Xcls_RightEditor( _this );
-            this.el.append( _this.RightEditor.el );
-            var child_3 = new Xcls_Box12( _this );
-            child_3.ref();
-            this.el.append ( child_3.el  );
+    public static Editor singleton()
+    {
+        if (_Editor == null) {
+            _Editor= new Editor();
         }
+        return _Editor;
+    }
+    public Xcls_save_button save_button;
+    public Xcls_close_btn close_btn;
+    public Xcls_RightEditor RightEditor;
+    public Xcls_view view;
+    public Xcls_buffer buffer;
+    public Xcls_search_entry search_entry;
+    public Xcls_search_results search_results;
+    public Xcls_nextBtn nextBtn;
+    public Xcls_backBtn backBtn;
+    public Xcls_search_settings search_settings;
+    public Xcls_case_sensitive case_sensitive;
+    public Xcls_regex regex;
+    public Xcls_multiline multiline;
+
+        // my vars (def)
+    public int pos_root_x;
+    public Xcls_MainWindow window;
+    public bool dirty;
+    public int pos_root_y;
+    public bool pos;
+    public GtkSource.SearchContext searchcontext;
+    public int last_search_end;
+    public signal void save ();
+    public JsRender.JsRender? file;
+    public JsRender.Node node;
+    public JsRender.NodeProp? prop;
+    public string activeEditor;
+
+    // ctor
+    public Editor()
+    {
+        _this = this;
+        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+        // my vars (dec)
+        this.window = null;
+        this.dirty = false;
+        this.pos = false;
+        this.searchcontext = null;
+        this.last_search_end = 0;
+        this.file = null;
+        this.node = null;
+        this.prop = null;
+        this.activeEditor = "";
+
+        // set gobject values
+        this.el.homogeneous = false;
+        this.el.hexpand = true;
+        this.el.vexpand = true;
+        var child_1 = new Xcls_Box2( _this );
+        child_1.ref();
+        this.el.append( child_1.el );
+        var child_2 = new Xcls_RightEditor( _this );
+        child_2.ref();
+        this.el.append( child_2.el );
+        var child_3 = new Xcls_Box12( _this );
+        child_3.ref();
+        this.el.append ( child_3.el  );
+    }
 
-        // user defined functions
-        public bool saveContents ()  {
-            
-            
-            if (_this.file == null) {
-                return true;
-            }
-            
-             
-             
-             var str = _this.buffer.toString();
-             
-             _this.buffer.checkSyntax();
-             
-             
-             
-             // LeftPanel.model.changed(  str , false);
-             _this.dirty = false;
-             _this.save_button.el.sensitive = false;
-             
-            // find the text for the node..
-            if (_this.file.xtype != "PlainFile") {
-               // in theory these properties have to exist!?!
-               this.prop.val = str;
-                //this.window.windowstate.left_props.reload();
-            } else {
-                _this.file.setSource(  str );
-             }
-            
-            // call the signal..
-            this.save();
-            
-            return true;
+    // user defined functions
+    public bool saveContents ()  {
         
-        }
-        public void forwardSearch (bool change_focus) {
         
-               if (this.searchcontext == null) {
-                       return;
-               } 
-               
-               Gtk.TextIter beg, st,en;
-                bool has_wrapped_around;
-               this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
-               if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
-               
-                       this.last_search_end = 0; // not sure if this should happen
-               } else {
-                       if (has_wrapped_around) {
-                               return;
-                       }
-               
-                       this.last_search_end = en.get_offset();
-                       if (change_focus) {
-                               this.view.el.grab_focus();
-                       }
-                       this.buffer.el.place_cursor(st);
-                       this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
-               }
-         
+        if (_this.file == null) {
+            return true;
         }
-        public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
-        {
-            this.reset();
-            this.file = file;    
-            
-            if (file.xtype != "PlainFile") {
-               this.prop = prop;
-                this.node = node;
         
-                // find the text for the node..
-                this.view.load( prop.val );
-                
-                
-                this.close_btn.el.show();       
-            
-            } else {
-                this.view.load(        file.toSource() );
-                this.close_btn.el.hide();
-            }
          
-        }
-        public void backSearch (bool change_focus) {
-        
-               if (this.searchcontext == null) {
-                       return;
-               } 
-               
-               Gtk.TextIter beg, st,en;
-               bool has_wrapped_around;
-               this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
-               
-               if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
-                       this.last_search_end = 0;
-               } else {
-                       this.last_search_end = en.get_offset();
-                       if (change_focus) {
-                               this.view.el.grab_focus();
-                       }
-                       this.buffer.el.place_cursor(st);
-                       this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
-               }
-        
-        }
-        public void reset () {
-                this.file = null;    
-             
-            this.node = null;
-            this.prop = null;
-               this.searchcontext = null;
-          
-        }
-        public int search (string in_txt) {
-        
-               var s = new GtkSource.SearchSettings();
-               s.case_sensitive = _this.case_sensitive.el.active;
-               s.regex_enabled = _this.regex.el.active;        
-               s.wrap_around = false;
-               
-               this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
-               this.searchcontext.set_highlight(true);
-               var txt = in_txt;
-               
-               if (_this.multiline.el.active) {
-                       txt = in_txt.replace("\\n", "\n");
-               }
-               
-               s.set_search_text(txt);
-               Gtk.TextIter beg, st,en;
-                
-               this.buffer.el.get_start_iter(out beg);
-               bool has_wrapped_around;
-               this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
-               this.last_search_end = 0;
-               
-               return this.searchcontext.get_occurrences_count();
-        
          
-           
-        
-        }
-        public void updateErrorMarks (string category) {
-               
+         var str = _this.buffer.toString();
          
-        
-               var buf = _this.buffer.el;
-               Gtk.TextIter start;
-               Gtk.TextIter end;     
-               buf.get_bounds (out start, out end);
-        
-               buf.remove_source_marks (start, end, category);
+         _this.buffer.checkSyntax();
          
-               GLib.debug("highlight errors");          
-        
-                // we should highlight other types of errors..
-        
-               if (_this.window.windowstate.state != WindowState.State.CODEONLY 
-                       &&
-                       _this.window.windowstate.state != WindowState.State.CODE
-                       ) {
-                       GLib.debug("windowstate != CODEONLY?");
-                       
-                       return;
-               } 
-        
-                
-               if (_this.file == null) {
-                       GLib.debug("file is null?");
-                       return;
-        
-               }
-               var ar = this.file.getErrors(category);
-               if (ar == null || ar.get_n_items() < 1) {
-                       GLib.debug("highlight %s :  %s has no errors", this.file.relpath, category);
-                       return;
-               }
          
-        
          
-               
-               var offset = 0;
-                
-        
-               var tlines = buf.get_line_count () +1;
-               
-               if (_this.prop != null) {
-               
-                       tlines = _this.prop.end_line + 1;
-                       offset = _this.prop.start_line + 1;
-               
-               }
-                
-               for (var i = 0; i < ar.get_n_items();i++) {
-                       var err = (Palete.CompileError) ar.get_item(i);
-                       
-                    Gtk.TextIter iter;
-        //        print("get inter\n");
-                   var eline = err.line - offset;
-                   GLib.debug("GOT ERROR on line %d -- converted to %d  (offset = %d)",
-                       err.line ,eline, offset);
-                   
-                   
-                   if (eline > tlines || eline < 0) {
-                       return;
-                   }
-                  
-                   
-                   buf.get_iter_at_line( out iter, eline);
-                  
-                  
-                       var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
-                   buf.create_source_mark( msg, err.category, iter);
-                   GLib.debug("set line %d to %s", eline, msg);
-                   //this.marks.set(eline, msg);
-               }
-               return ;
-        
-        
-        
+         // LeftPanel.model.changed(  str , false);
+         _this.dirty = false;
+         _this.save_button.el.sensitive = false;
          
+        // find the text for the node..
+        if (_this.file.xtype != "PlainFile") {
+           // in theory these properties have to exist!?!
+               this.prop.val = str;
+            //this.window.windowstate.left_props.reload();
+        } else {
+            _this.file.setSource(  str );
+         }
         
-        }
-        public void scroll_to_line (int line) {
-        
-               GLib.Timeout.add(500, () => {
-           
-                       var buf = this.view.el.get_buffer();
+        // call the signal..
+        this.save();
         
-                       var sbuf = (GtkSource.Buffer) buf;
+        return true;
+    
+    }
+    public void forwardSearch (bool change_focus) {
+    
+       if (this.searchcontext == null) {
+               return;
+       } 
+       
+       Gtk.TextIter beg, st,en;
+        bool has_wrapped_around;
+       this.buffer.el.get_iter_at_offset(out beg, this.last_search_end);
+       if (!this.searchcontext.forward(beg, out st, out en, out has_wrapped_around)) {
+       
+               this.last_search_end = 0; // not sure if this should happen
+       } else {
+               if (has_wrapped_around) {
+                       return;
+               }
+       
+               this.last_search_end = en.get_offset();
+               if (change_focus) {
+                       this.view.el.grab_focus();
+               }
+               this.buffer.el.place_cursor(st);
+               this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
+       }
+     
+    }
+    public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
+    {
+        this.reset();
+        this.file = file;    
         
+        if (file.xtype != "PlainFile") {
+               this.prop = prop;
+            this.node = node;
+    
+            // find the text for the node..
+            this.view.load( prop.val );
+            
+            
+            this.close_btn.el.show();       
         
-                       Gtk.TextIter iter;   
-                       sbuf.get_iter_at_line(out iter,  line);
-                       this.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
-                       return false;
-               });   
+        } else {
+            this.view.load(        file.toSource() );
+            this.close_btn.el.hide();
         }
-        public class Xcls_Box2 : Object
-        {
-            public Gtk.Box el;
-            private Editor  _this;
+     
+    }
+    public void backSearch (bool change_focus) {
+    
+       if (this.searchcontext == null) {
+               return;
+       } 
+       
+       Gtk.TextIter beg, st,en;
+       bool has_wrapped_around;
+       this.buffer.el.get_iter_at_offset(out beg, this.last_search_end -1 );
+       
+       if (!this.searchcontext.backward(beg, out st, out en, out has_wrapped_around)) {
+               this.last_search_end = 0;
+       } else {
+               this.last_search_end = en.get_offset();
+               if (change_focus) {
+                       this.view.el.grab_focus();
+               }
+               this.buffer.el.place_cursor(st);
+               this.view.el.scroll_to_iter(st,  0.1f, true, 0.0f, 0.5f);
+       }
+    
+    }
+    public void reset () {
+        this.file = null;    
+         
+        this.node = null;
+        this.prop = null;
+       this.searchcontext = null;
+      
+    }
+    public int search (string in_txt) {
+    
+       var s = new GtkSource.SearchSettings();
+       s.case_sensitive = _this.case_sensitive.el.active;
+       s.regex_enabled = _this.regex.el.active;        
+       s.wrap_around = false;
+       
+       this.searchcontext = new GtkSource.SearchContext(this.buffer.el,s);
+       this.searchcontext.set_highlight(true);
+       var txt = in_txt;
+       
+       if (_this.multiline.el.active) {
+               txt = in_txt.replace("\\n", "\n");
+       }
+       
+       s.set_search_text(txt);
+       Gtk.TextIter beg, st,en;
+        
+       this.buffer.el.get_start_iter(out beg);
+       bool has_wrapped_around;
+       this.searchcontext.forward(beg, out st, out en, out has_wrapped_around);
+       this.last_search_end = 0;
+       
+       return this.searchcontext.get_occurrences_count();
+    
+     
+       
+    
+    }
+    public void updateErrorMarks (string category) {
+       
+     
+    
+       var buf = _this.buffer.el;
+       Gtk.TextIter start;
+       Gtk.TextIter end;     
+       buf.get_bounds (out start, out end);
+    
+       buf.remove_source_marks (start, end, category);
+     
+       GLib.debug("highlight errors");          
+    
+        // we should highlight other types of errors..
+    
+       if (_this.window.windowstate.state != WindowState.State.CODEONLY 
+               &&
+               _this.window.windowstate.state != WindowState.State.CODE
+               ) {
+               GLib.debug("windowstate != CODEONLY?");
+               
+               return;
+       } 
+    
+        
+       if (_this.file == null) {
+               GLib.debug("file is null?");
+               return;
+    
+       }
+       var ar = this.file.getErrors(category);
+       if (ar == null || ar.get_n_items() < 1) {
+               GLib.debug("highlight %s :  %s has no errors", this.file.relpath, category);
+               return;
+       }
+     
+    
+     
+       
+       var offset = 0;
+        
+    
+       var tlines = buf.get_line_count () +1;
+       
+       if (_this.prop != null) {
+       
+               tlines = _this.prop.end_line + 1;
+               offset = _this.prop.start_line + 1;
+       
+       }
+        
+       for (var i = 0; i < ar.get_n_items();i++) {
+               var err = (Palete.CompileError) ar.get_item(i);
+               
+            Gtk.TextIter iter;
+    //        print("get inter\n");
+           var eline = err.line - offset;
+           GLib.debug("GOT ERROR on line %d -- converted to %d  (offset = %d)",
+               err.line ,eline, offset);
+           
+           
+           if (eline > tlines || eline < 0) {
+               return;
+           }
+          
+           
+           buf.get_iter_at_line( out iter, eline);
+          
+          
+               var msg = "Line: %d %s : %s".printf(eline+1, err.category, err.msg);
+           buf.create_source_mark( msg, err.category, iter);
+           GLib.debug("set line %d to %s", eline, msg);
+           //this.marks.set(eline, msg);
+       }
+       return ;
+    
+    
+    
+     
+    
+    }
+    public void scroll_to_line (int line) {
+    
+       GLib.Timeout.add(500, () => {
+       
+               var buf = this.view.el.get_buffer();
+    
+               var sbuf = (GtkSource.Buffer) buf;
+    
+    
+               Gtk.TextIter iter;   
+               sbuf.get_iter_at_line(out iter,  line);
+               this.view.el.scroll_to_iter(iter,  0.1f, true, 0.0f, 0.5f);
+               return false;
+       });   
+    }
+    public class Xcls_Box2 : Object
+    {
+        public Gtk.Box el;
+        private Editor  _this;
 
 
-                // my vars (def)
+            // my vars (def)
 
-            // ctor
-            public Xcls_Box2(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.homogeneous = false;
-                this.el.hexpand = true;
-                new Xcls_save_button( _this );
-                this.el.append( _this.save_button.el );
-                var child_2 = new Xcls_Label4( _this );
-                child_2.ref();
-                this.el.append( child_2.el );
-                var child_3 = new Xcls_Scale5( _this );
-                child_3.ref();
-                this.el.append( child_3.el );
-                new Xcls_close_btn( _this );
-                this.el.append( _this.close_btn.el );
-            }
+        // ctor
+        public Xcls_Box2(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
-            // user defined functions
+            // my vars (dec)
+
+            // set gobject values
+            this.el.homogeneous = false;
+            this.el.hexpand = true;
+            var child_1 = new Xcls_save_button( _this );
+            child_1.ref();
+            this.el.append( child_1.el );
+            var child_2 = new Xcls_Label4( _this );
+            child_2.ref();
+            this.el.append( child_2.el );
+            var child_3 = new Xcls_Scale5( _this );
+            child_3.ref();
+            this.el.append( child_3.el );
+            var child_4 = new Xcls_close_btn( _this );
+            child_4.ref();
+            this.el.append( child_4.el );
         }
-        public class Xcls_save_button : Object
-        {
-            public Gtk.Button el;
-            private Editor  _this;
 
+        // user defined functions
+    }
+    public class Xcls_save_button : Object
+    {
+        public Gtk.Button el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_save_button(Editor _owner )
-            {
-                _this = _owner;
-                _this.save_button = this;
-                this.el = new Gtk.Button();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_save_button(Editor _owner )
+        {
+            _this = _owner;
+            _this.save_button = this;
+            this.el = new Gtk.Button();
 
-                // set gobject values
-                this.el.label = "Save";
+            // my vars (dec)
 
-                //listeners
-                this.el.clicked.connect( () => { 
-                    _this.saveContents();
-                });
-            }
+            // set gobject values
+            this.el.label = "Save";
 
-            // user defined functions
+            //listeners
+            this.el.clicked.connect( () => { 
+                _this.saveContents();
+            });
         }
 
-        public class Xcls_Label4 : Object
-        {
-            public Gtk.Label el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_Label4 : Object
+    {
+        public Gtk.Label el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_Label4(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Label( null );
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_Label4(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( null );
 
-                // set gobject values
-                this.el.hexpand = true;
-            }
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            this.el.hexpand = true;
         }
 
-        public class Xcls_Scale5 : Object
-        {
-            public Gtk.Scale el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_Scale5 : Object
+    {
+        public Gtk.Scale el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_Scale5(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_Scale5(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
 
-                // set gobject values
-                this.el.width_request = 200;
-                this.el.has_origin = true;
-                this.el.draw_value = false;
-                this.el.digits = 0;
-                this.el.sensitive = true;
+            // my vars (dec)
 
-                // init method
+            // set gobject values
+            this.el.width_request = 200;
+            this.el.has_origin = true;
+            this.el.draw_value = false;
+            this.el.digits = 0;
+            this.el.sensitive = true;
 
-                {
-                       this.el.set_range(6,30);
-                       this.el.set_value(8);
-                }
+            // init method
 
-                //listeners
-                this.el.change_value.connect( (st, val ) => {
-                        
-                          
-                         _this.view.css.load_from_string(
-                                       "#editor-view { font: %dpx monospace; }".printf((int)val)
-                          );
-                     
-                       return false;
-                });
+            {
+               this.el.set_range(6,30);
+               this.el.set_value(8);
             }
 
-            // user defined functions
+            //listeners
+            this.el.change_value.connect( (st, val ) => {
+                
+                  
+                 _this.view.css.load_from_string(
+                               "#editor-view { font: %dpx monospace; }".printf((int)val)
+                  );
+                 
+               return false;
+            });
         }
 
-        public class Xcls_close_btn : Object
-        {
-            public Gtk.Button el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_close_btn : Object
+    {
+        public Gtk.Button el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_close_btn(Editor _owner )
-            {
-                _this = _owner;
-                _this.close_btn = this;
-                this.el = new Gtk.Button();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_close_btn(Editor _owner )
+        {
+            _this = _owner;
+            _this.close_btn = this;
+            this.el = new Gtk.Button();
 
-                // set gobject values
-                this.el.icon_name = "window-close";
-                var child_1 = new Xcls_Image7( _this );
-                this.el.child = child_1.el;
+            // my vars (dec)
 
-                //listeners
-                this.el.clicked.connect( () => { 
-                    _this.saveContents();
-                    _this.window.windowstate.switchState(WindowState.State.PREVIEW);
-                });
-            }
+            // set gobject values
+            this.el.icon_name = "window-close";
+            var child_1 = new Xcls_Image7( _this );
+            child_1.ref();
+            this.el.child = child_1.el;
 
-            // user defined functions
+            //listeners
+            this.el.clicked.connect( () => { 
+                _this.saveContents();
+                _this.window.windowstate.switchState(WindowState.State.PREVIEW);
+            });
         }
-        public class Xcls_Image7 : Object
-        {
-            public Gtk.Image el;
-            private Editor  _this;
 
+        // user defined functions
+    }
+    public class Xcls_Image7 : Object
+    {
+        public Gtk.Image el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_Image7(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Image();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_Image7(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
 
-                // set gobject values
-                this.el.icon_name = "window-close";
-                this.el.icon_size = Gtk.IconSize.NORMAL;
-            }
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            this.el.icon_name = "window-close";
+            this.el.icon_size = Gtk.IconSize.NORMAL;
         }
 
+        // user defined functions
+    }
 
 
-        public class Xcls_RightEditor : Object
-        {
-            public Gtk.ScrolledWindow el;
-            private Editor  _this;
 
+    public class Xcls_RightEditor : Object
+    {
+        public Gtk.ScrolledWindow el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_RightEditor(Editor _owner )
-            {
-                _this = _owner;
-                _this.RightEditor = this;
-                this.el = new Gtk.ScrolledWindow();
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
-                this.el.vexpand = true;
-                this.el.overlay_scrolling = false;
-                this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
-                new Xcls_view( _this );
-                this.el.child = _this.view.el;
-            }
+            // my vars (def)
 
-            // user defined functions
-        }
-        public class Xcls_view : Object
+        // ctor
+        public Xcls_RightEditor(Editor _owner )
         {
-            public GtkSource.View el;
-            private Editor  _this;
+            _this = _owner;
+            _this.RightEditor = this;
+            this.el = new Gtk.ScrolledWindow();
 
+            // my vars (dec)
 
-                // my vars (def)
-            public Gtk.CssProvider css;
+            // set gobject values
+            this.el.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+            this.el.vexpand = true;
+            this.el.overlay_scrolling = false;
+            this.el.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
+            var child_1 = new Xcls_view( _this );
+            child_1.ref();
+            this.el.child = child_1.el;
+        }
 
-            // ctor
-            public Xcls_view(Editor _owner )
-            {
-                _this = _owner;
-                _this.view = this;
-                this.el = new GtkSource.View();
-
-                // my vars (dec)
-                this.css = null;
-
-                // set gobject values
-                this.el.auto_indent = true;
-                this.el.indent_width = 4;
-                this.el.name = "editor-view";
-                this.el.show_line_marks = true;
-                this.el.insert_spaces_instead_of_tabs = true;
-                this.el.show_line_numbers = true;
-                this.el.hexpand = true;
-                this.el.vexpand = true;
-                this.el.has_tooltip = true;
-                this.el.tab_width = 4;
-                this.el.highlight_current_line = true;
-                new Xcls_buffer( _this );
-                this.el.buffer = _this.buffer.el;
-                var child_2 = new Xcls_EventControllerKey11( _this );
-                child_2.ref();
-                this.el.add_controller(  child_2.el );
-
-                // init method
-
-                this.css = new Gtk.CssProvider();
-                
-                this.css.load_from_string(
-                       "#editor-view { font:  12px monospace;}"
-                );
-                 
-                Gtk.StyleContext.add_provider_for_display(
-                       this.el.get_display(),
-                       this.css,
-                       Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                );
-                       
-                 
-                        
-                /*
-                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.select_on_show = true; // select
-                this.el.completion.remember_info_visibility     = true;
-                
-                
-                var attrs = new GtkSource.MarkAttributes();
-                var  pink =   Gdk.RGBA();
-                pink.parse ( "pink");
-                attrs.set_background ( pink);
-                attrs.set_icon_name ( "process-stop");    
-                attrs.query_tooltip_text.connect(( mark) => {
-                     GLib.debug("tooltip query? %s", mark.name);
-                    return strdup( mark.name);
-                });
-                 attrs.query_tooltip_markup.connect(( mark) => {
-                     GLib.debug("tooltip query? %s", mark.name);
-                    return strdup( mark.name);
-                });
-                this.el.set_mark_attributes ("ERR", attrs, 1);
-                attrs.ref();
-                 var wattrs = new GtkSource.MarkAttributes();
-                var  blue =   Gdk.RGBA();
-                blue.parse ( "#ABF4EB");
-                wattrs.set_background ( blue);
-                wattrs.set_icon_name ( "process-stop");    
-                wattrs.query_tooltip_text.connect(( mark) => {
-                     GLib.debug("tooltip query? %s", mark.name);
-                    return strdup(mark.name);
-                });
-                wattrs.query_tooltip_markup.connect(( mark) => {
-                     GLib.debug("tooltip query? %s", mark.name);
-                    return strdup(mark.name);
-                });
-                this.el.set_mark_attributes ("WARN", wattrs, 1);
-                wattrs.ref();
-                
-                
-                 var dattrs = new GtkSource.MarkAttributes();
-                var  purple =   Gdk.RGBA();
-                purple.parse ( "#EEA9FF");
-                dattrs.set_background ( purple);
-                dattrs.set_icon_name ( "process-stop");    
-                dattrs.query_tooltip_text.connect(( mark) => {
-                       GLib.debug("tooltip query? %s", mark.name);
-                    return strdup(mark.name);
-                });
-                dattrs.query_tooltip_markup.connect(( mark) => {
-                       GLib.debug("tooltip query? %s", mark.name);
-                    return strdup(mark.name);
-                });
-                this.el.set_mark_attributes ("DEPR", dattrs, 1);
-                dattrs.ref();    
-                
-                 this.el.get_space_drawer().set_matrix(null);
-                 this.el.get_space_drawer().set_types_for_locations( 
-                       GtkSource.SpaceLocationFlags.ALL,
-                       GtkSource.SpaceTypeFlags.ALL
-                );
-                this.el.get_space_drawer().set_enable_matrix(true);
-                /*
-                Gtk.SourceDrawSpacesFlags.LEADING + 
-                Gtk.SourceDrawSpacesFlags.TRAILING + 
-                Gtk.SourceDrawSpacesFlags.TAB + 
-                Gtk.SourceDrawSpacesFlags.SPACE
-                */
-
-                //listeners
-                this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
-                       
-                       //GLib.debug("query tooltip");
-                       Gtk.TextIter iter;
-                       int trailing;
-                       
-                       var yoff = (int) _this.RightEditor.el.vadjustment.value;
-                       
-                       // I think this is problematic - if it's compliing  / updating at same time as query.
-                       
-                       //if (_this.window.statusbar_compile_spinner.el.spinning) {
-                       //      return false;
-                       //}
-                       
-                       this.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);
-                        
-                       var l = iter.get_line();
-                
-                       
-                        
-                       // GLib.debug("query tooltip line %d", (int) l);
-                       if (l < 0) {
-                
-                               return false;
-                       }
-                       /*
-                       if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
-                               GLib.debug("line %d setting tip to %s", l,  _this.buffer.marks.get(l));
-                               tooltip.set_text(_this.buffer.marks.get(l).dup());
-                               return true;
-                       }
-                 
-                       return false;
-                       */
-                       
-                         
-                       // this crashes?? - not sure why.
-                       var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
-                       if (marks.is_empty()) {
-                               marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
-                       }
-                       if (marks.is_empty()) {
-                               marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
-                       }
-                       
-                       // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
-                       var str = "";
-                       marks.@foreach((m) => { 
-                               //GLib.debug("got mark %s", m.name);
-                               str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
-                       });
-                       // true if there is a mark..
-                       if (str.length > 0 ) {
-                               tooltip.set_text( str );
-                       }
-                       return str.length > 0 ? true : false;
-                        
-                });
-            }
+        // user defined functions
+    }
+    public class Xcls_view : Object
+    {
+        public GtkSource.View el;
+        private Editor  _this;
 
-            // user defined functions
-            public void load (string str) {
-            
-            // show the help page for the active node..
-               //this.get('/Help').show();
-             
-              // this.get('/BottomPane').el.set_current_page(0);
-               GLib.debug("load called - Reset undo buffer");
-               
-                var buf = (GtkSource.Buffer)this.el.get_buffer();
-                buf.begin_irreversible_action();
-                buf.set_text(str, str.length);
-                buf.end_irreversible_action();
-                
-                var lm = GtkSource.LanguageManager.get_default();
-                var lang = "vala";
-                if (_this.file != null) {
-                     lang = _this.file.language;
-                }
-                print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
-                var lg = _this.file.content_type.length > 0  ?
-                        lm.guess_language(_this.file.path, _this.file.content_type) :
-                        lm.get_language(lang);
-                 
-               
-                ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); 
-            
-                this.el.insert_spaces_instead_of_tabs = true;
-                if (lg != null) {
-                       print("sourcelanguage  = %s\n", lg.name);
-                       if (lg.name == "Vala") {
-                           this.el.insert_spaces_instead_of_tabs = false;
-                       }
-                 }
-                _this.dirty = false;
-                this.el.grab_focus();
-                _this.save_button.el.sensitive = false;
-            }
-        }
-        public class Xcls_buffer : Object
+
+            // my vars (def)
+        public Gtk.CssProvider css;
+
+        // ctor
+        public Xcls_view(Editor _owner )
         {
-            public GtkSource.Buffer el;
-            private Editor  _this;
+            _this = _owner;
+            _this.view = this;
+            this.el = new GtkSource.View();
 
+            // my vars (dec)
+            this.css = null;
 
-                // my vars (def)
-            public int error_line;
-            public Gee.HashMap<int,string>? xmarks;
-            public bool check_queued;
+            // set gobject values
+            this.el.auto_indent = true;
+            this.el.indent_width = 4;
+            this.el.name = "editor-view";
+            this.el.show_line_marks = true;
+            this.el.insert_spaces_instead_of_tabs = true;
+            this.el.show_line_numbers = true;
+            this.el.hexpand = true;
+            this.el.vexpand = true;
+            this.el.has_tooltip = true;
+            this.el.tab_width = 4;
+            this.el.highlight_current_line = true;
+            var child_1 = new Xcls_buffer( _this );
+            child_1.ref();
+            this.el.buffer = child_1.el;
+            var child_2 = new Xcls_EventControllerKey11( _this );
+            child_2.ref();
+            this.el.add_controller(  child_2.el );
 
-            // ctor
-            public Xcls_buffer(Editor _owner )
-            {
-                _this = _owner;
-                _this.buffer = this;
-                this.el = new GtkSource.Buffer( null );
-
-                // my vars (dec)
-                this.error_line = -1;
-                this.xmarks = null;
-                this.check_queued = false;
-
-                // set gobject values
-                this.el.enable_undo = true;
-
-                //listeners
-                this.el.changed.connect( () => {
-                    // check syntax??
-                    // ??needed..??
-                    _this.save_button.el.sensitive = true;
-                    print("EDITOR CHANGED");
-                    this.checkSyntax();
-                   
-                    _this.dirty = true;
-                
-                    // this.get('/LeftPanel.model').changed(  str , false);
-                    return ;
-                });
-            }
+            // init method
 
-            // user defined functions
-            public bool checkSyntax () {
-             
-                
-                var str = this.toString();
-                
-                // needed???
-                if (this.error_line > 0) {
-                     Gtk.TextIter start;
-                     Gtk.TextIter end;     
-                    this.el.get_bounds (out start, out end);
+            this.css = new Gtk.CssProvider();
             
-                    this.el.remove_source_marks (start, end, null);
-                }
-                if (str.length < 1) {
-                    print("checkSyntax - empty string?\n");
-                    return true;
-                }
-                
-                // bit presumptiona
-                if (_this.file.xtype == "PlainFile") {
-                
-                    // assume it's gtk...
-                     var  oldcode =_this.file.toSource();
-                    _this.file.setSource(str);
-                    _this.file.getLanguageServer().document_change(_this.file);
-                    _this.file.setSource(oldcode);
-                    
-                        
-                    return true;
-                
-                }
-               if (_this.file == null) {
-                   return true;
-               }
+            this.css.load_from_string(
+               "#editor-view { font:  12px monospace;}"
+            );
              
-                
-            
-                  
-                 
-                GLib.debug("calling validate");    
-                // clear the buttons.
-               if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
-                       return true ;
-               }
-               var oldcode  = _this.prop.val;
+            Gtk.StyleContext.add_provider_for_display(
+               this.el.get_display(),
+               this.css,
+               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+            );
                
-               _this.prop.val = str;
-                _this.file.getLanguageServer().document_change(_this.file);
-                _this.prop.val = oldcode;
-                
-                
-                //print("done mark line\n");
-                 
-                return true; // at present allow saving - even if it's invalid..
-            }
-            public bool highlightErrorsJson (string type, Json.Object obj) {
-               Gtk.TextIter start;
-               Gtk.TextIter end;     
-               this.el.get_bounds (out start, out end);
-            
-               this.el.remove_source_marks (start, end, type);
-               GLib.debug("highlight errors");          
-            
-                // we should highlight other types of errors..
-            
-               if (!obj.has_member(type)) {
-                       GLib.debug("Return has no errors\n");
-                       return true;
-               }
-            
-               if (_this.window.windowstate.state != WindowState.State.CODEONLY 
-                       &&
-                       _this.window.windowstate.state != WindowState.State.CODE
-                       ) {
-                       GLib.debug("windowstate != CODEONLY?");
-                       
-                       return true;
-               } 
-            
-               //this.marks = new Gee.HashMap<int,string>();
-               var err = obj.get_object_member(type);
              
-               if (_this.file == null) {
-                       GLib.debug("file is null?");
-                       return true;
+                
+            /*
+            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.select_on_show = true; // select
+            //this.el.completion.remember_info_visibility       = true;
             
-               }
-               var valafn = _this.file.path;
             
-               if (_this.file.xtype != "PlainFile") {
+            var attrs = new GtkSource.MarkAttributes();
+            var  pink =   Gdk.RGBA();
+            pink.parse ( "pink");
+            attrs.set_background ( pink);
+            attrs.set_icon_name ( "process-stop");    
+            attrs.query_tooltip_text.connect(( mark) => {
+                 GLib.debug("tooltip query? %s", mark.name);
+                return strdup( mark.name);
+            });
+             attrs.query_tooltip_markup.connect(( mark) => {
+                 GLib.debug("tooltip query? %s", mark.name);
+                return strdup( mark.name);
+            });
+            this.el.set_mark_attributes ("ERR", attrs, 1);
+            attrs.ref();
+             var wattrs = new GtkSource.MarkAttributes();
+            var  blue =   Gdk.RGBA();
+            blue.parse ( "#ABF4EB");
+            wattrs.set_background ( blue);
+            wattrs.set_icon_name ( "process-stop");    
+            wattrs.query_tooltip_text.connect(( mark) => {
+                 GLib.debug("tooltip query? %s", mark.name);
+                return strdup(mark.name);
+            });
+            wattrs.query_tooltip_markup.connect(( mark) => {
+                 GLib.debug("tooltip query? %s", mark.name);
+                return strdup(mark.name);
+            });
+            this.el.set_mark_attributes ("WARN", wattrs, 1);
+            wattrs.ref();
             
-                       valafn = "";
-                       try {             
-                               var  regex = new Regex("\\.bjs$");
-                               // should not happen
-                               valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
-                       } catch (GLib.RegexError e) {
-                               return true;
-                       }   
             
+             var dattrs = new GtkSource.MarkAttributes();
+            var  purple =   Gdk.RGBA();
+            purple.parse ( "#EEA9FF");
+            dattrs.set_background ( purple);
+            dattrs.set_icon_name ( "process-stop");    
+            dattrs.query_tooltip_text.connect(( mark) => {
+               GLib.debug("tooltip query? %s", mark.name);
+                return strdup(mark.name);
+            });
+            dattrs.query_tooltip_markup.connect(( mark) => {
+               GLib.debug("tooltip query? %s", mark.name);
+                return strdup(mark.name);
+            });
+            this.el.set_mark_attributes ("DEPR", dattrs, 1);
+            dattrs.ref();    
             
+             this.el.get_space_drawer().set_matrix(null);
+             this.el.get_space_drawer().set_types_for_locations( 
+               GtkSource.SpaceLocationFlags.ALL,
+               GtkSource.SpaceTypeFlags.ALL
+            );
+            this.el.get_space_drawer().set_enable_matrix(true);
+            /*
+            Gtk.SourceDrawSpacesFlags.LEADING + 
+            Gtk.SourceDrawSpacesFlags.TRAILING + 
+            Gtk.SourceDrawSpacesFlags.TAB + 
+            Gtk.SourceDrawSpacesFlags.SPACE
+            */
+
+            //listeners
+            this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
+               
+               //GLib.debug("query tooltip");
+               Gtk.TextIter iter;
+               int trailing;
+               
+               var yoff = (int) _this.RightEditor.el.vadjustment.value;
+               
+               // I think this is problematic - if it's compliing  / updating at same time as query.
+               
+               //if (_this.window.statusbar_compile_spinner.el.spinning) {
+               //      return false;
+               //}
+               
+               this.el.get_iter_at_position (out iter, out trailing,  x,  y + yoff);
+                
+               var l = iter.get_line();
             
+               
+                
+               // GLib.debug("query tooltip line %d", (int) l);
+               if (l < 0) {
+            
+                       return false;
                }
-               if (!err.has_member(valafn)) {
-                       GLib.debug("File path has no errors");
-                       return  true;
+               /*
+               if (_this.buffer.marks != null && _this.buffer.marks.has_key(l)) {
+                       GLib.debug("line %d setting tip to %s", l,  _this.buffer.marks.get(l));
+                       tooltip.set_text(_this.buffer.marks.get(l).dup());
+                       return true;
                }
-            
-               var lines = err.get_object_member(valafn);
+             
+               return false;
+               */
                
-               var offset = 1;
-               if (obj.has_member("line_offset")) { // ?? why??
-                       offset = (int)obj.get_int_member("line_offset") + 1;
+                 
+               // this crashes?? - not sure why.
+               var marks = _this.buffer.el.get_source_marks_at_line(l, "ERR");
+               if (marks.is_empty()) {
+                       marks = _this.buffer.el.get_source_marks_at_line(l, "WARN");
                }
-            
-            
-               var tlines = this.el.get_line_count () +1;
-               
-               if (_this.prop != null) {
-               
-                       tlines = _this.prop.end_line + 1;
-                       offset = _this.prop.start_line + 1;
-               
+               if (marks.is_empty()) {
+                       marks = _this.buffer.el.get_source_marks_at_line(l, "DEPR");
                }
                
+               // GLib.debug("query tooltip line %d marks %d", (int)l, (int) marks.length());
+               var str = "";
+               marks.@foreach((m) => { 
+                       //GLib.debug("got mark %s", m.name);
+                       str += (str.length > 0 ? "\n" : "") + m.category + ": " + m.name;
+               });
+               // true if there is a mark..
+               if (str.length > 0 ) {
+                       tooltip.set_text( str );
+               }
+               return str.length > 0 ? true : false;
+                
+            });
+        }
+
+        // user defined functions
+        public void load (string str) {
+        
+        // show the help page for the active node..
+           //this.get('/Help').show();
+         
+          // this.get('/BottomPane').el.set_current_page(0);
+               GLib.debug("load called - Reset undo buffer");
+               
+            var buf = (GtkSource.Buffer)this.el.get_buffer();
+            buf.begin_irreversible_action();
+            buf.set_text(str, str.length);
+            buf.end_irreversible_action();
             
+            var lm = GtkSource.LanguageManager.get_default();
+            var lang = "vala";
+            if (_this.file != null) {
+                 lang = _this.file.language;
+            }
+            print("lang=%s, content_type = %s\n", lang, _this.file.content_type);
+            var lg = _this.file.content_type.length > 0  ?
+                    lm.guess_language(_this.file.path, _this.file.content_type) :
+                    lm.get_language(lang);
+             
+           
+            ((GtkSource.Buffer)(this.el.get_buffer())) .set_language(lg); 
+        
+            this.el.insert_spaces_instead_of_tabs = true;
+            if (lg != null) {
+                       print("sourcelanguage  = %s\n", lg.name);
+                       if (lg.name == "Vala") {
+                           this.el.insert_spaces_instead_of_tabs = false;
+                       }
+             }
+            _this.dirty = false;
+            this.el.grab_focus();
+            _this.save_button.el.sensitive = false;
+        }
+    }
+    public class Xcls_buffer : Object
+    {
+        public GtkSource.Buffer el;
+        private Editor  _this;
+
+
+            // my vars (def)
+        public int error_line;
+        public Gee.HashMap<int,string>? xmarks;
+        public bool check_queued;
+
+        // ctor
+        public Xcls_buffer(Editor _owner )
+        {
+            _this = _owner;
+            _this.buffer = this;
+            this.el = new GtkSource.Buffer( null );
+
+            // my vars (dec)
+            this.error_line = -1;
+            this.xmarks = null;
+            this.check_queued = false;
+
+            // set gobject values
+            this.el.enable_undo = true;
+
+            //listeners
+            this.el.changed.connect( () => {
+                // check syntax??
+                // ??needed..??
+                _this.save_button.el.sensitive = true;
+                print("EDITOR CHANGED");
+                this.checkSyntax();
+               
+                _this.dirty = true;
             
-               lines.foreach_member((obj, line, node) => {
-                       
-                    Gtk.TextIter iter;
-            //        print("get inter\n");
-                   var eline = int.parse(line) - offset;
-                   GLib.debug("GOT ERROR on line %s -- converted to %d  (offset = %d)\n", line,eline, offset);
-                   
-                   
-                   if (eline > tlines || eline < 0) {
-                       return;
-                   }
-                  
-                   
-                   this.el.get_iter_at_line( out iter, eline);
-                   //print("mark line\n");
-                   var msg  = "";
-                   var ar = lines.get_array_member(line);
-                   for (var i = 0 ; i < ar.get_length(); i++) {
-                       if (ar.get_string_element(i) == "Success") {
-                               continue;
-                               }
-                               msg += (msg.length > 0) ? "\n" : "";
-                               msg += ar.get_string_element(i);
-                       }
-                       if (msg == "") {
-                               return;
-                       }
-                       msg = "Line: %d".printf(eline+1) +  " " + msg;
-                   this.el.create_source_mark(msg, type, iter);
-                   GLib.debug("set line %d to %m", eline, msg);
-                  // this.marks.set(eline, msg);
-               } );
-               return false;
+                // this.get('/LeftPanel.model').changed(  str , false);
+                return ;
+            });
+        }
+
+        // user defined functions
+        public bool checkSyntax () {
+         
+            
+            var str = this.toString();
+            
+            // needed???
+            if (this.error_line > 0) {
+                 Gtk.TextIter start;
+                 Gtk.TextIter end;     
+                this.el.get_bounds (out start, out end);
+        
+                this.el.remove_source_marks (start, end, null);
+            }
+            if (str.length < 1) {
+                print("checkSyntax - empty string?\n");
+                return true;
+            }
             
+            // bit presumptiona
+            if (_this.file.xtype == "PlainFile") {
+            
+                // assume it's gtk...
+                 var  oldcode =_this.file.toSource();
+                _this.file.setSource(str);
+                _this.file.getLanguageServer().document_change(_this.file);
+                _this.file.setSource(oldcode);
+                
+                        
+                return true;
             
+            }
+           if (_this.file == null) {
+               return true;
+           }
+         
+            
+        
+              
+             
+            GLib.debug("calling validate");    
+            // clear the buttons.
+               if (_this.prop.name == "xns" || _this.prop.name == "xtype") {
+                       return true ;
+               }
+               var oldcode  = _this.prop.val;
+               
+               _this.prop.val = str;
+            _this.file.getLanguageServer().document_change(_this.file);
+            _this.prop.val = oldcode;
             
             
+            //print("done mark line\n");
+             
+            return true; // at present allow saving - even if it's invalid..
+        }
+        public bool highlightErrorsJson (string type, Json.Object obj) {
+               Gtk.TextIter start;
+               Gtk.TextIter end;     
+               this.el.get_bounds (out start, out end);
+        
+               this.el.remove_source_marks (start, end, type);
+               GLib.debug("highlight errors");          
+        
+                // we should highlight other types of errors..
+        
+               if (!obj.has_member(type)) {
+                       GLib.debug("Return has no errors\n");
+                       return true;
+               }
+        
+               if (_this.window.windowstate.state != WindowState.State.CODEONLY 
+                       &&
+                       _this.window.windowstate.state != WindowState.State.CODE
+                       ) {
+                       GLib.debug("windowstate != CODEONLY?");
+                       
+                       return true;
+               } 
+        
+               //this.marks = new Gee.HashMap<int,string>();
+               var err = obj.get_object_member(type);
+         
+               if (_this.file == null) {
+                       GLib.debug("file is null?");
+                       return true;
+        
+               }
+               var valafn = _this.file.path;
+        
+               if (_this.file.xtype != "PlainFile") {
+        
+                       valafn = "";
+                       try {             
+                               var  regex = new Regex("\\.bjs$");
+                               // should not happen
+                               valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
+                       } catch (GLib.RegexError e) {
+                               return true;
+                       }   
+        
+        
+        
+               }
+               if (!err.has_member(valafn)) {
+                       GLib.debug("File path has no errors");
+                       return  true;
+               }
+        
+               var lines = err.get_object_member(valafn);
+               
+               var offset = 1;
+               if (obj.has_member("line_offset")) { // ?? why??
+                       offset = (int)obj.get_int_member("line_offset") + 1;
+               }
+        
+        
+               var tlines = this.el.get_line_count () +1;
+               
+               if (_this.prop != null) {
+               
+                       tlines = _this.prop.end_line + 1;
+                       offset = _this.prop.start_line + 1;
+               
+               }
+               
+        
+        
+               lines.foreach_member((obj, line, node) => {
+                       
+                    Gtk.TextIter iter;
+        //        print("get inter\n");
+                   var eline = int.parse(line) - offset;
+                   GLib.debug("GOT ERROR on line %s -- converted to %d  (offset = %d)\n", line,eline, offset);
+                   
+                   
+                   if (eline > tlines || eline < 0) {
+                       return;
+                   }
+                  
+                   
+                   this.el.get_iter_at_line( out iter, eline);
+                   //print("mark line\n");
+                   var msg  = "";
+                   var ar = lines.get_array_member(line);
+                   for (var i = 0 ; i < ar.get_length(); i++) {
+                       if (ar.get_string_element(i) == "Success") {
+                               continue;
+                       }
+                               msg += (msg.length > 0) ? "\n" : "";
+                               msg += ar.get_string_element(i);
+                       }
+                       if (msg == "") {
+                               return;
+                       }
+                       msg = "Line: %d".printf(eline+1) +  " " + msg;
+                   this.el.create_source_mark(msg, type, iter);
+                   GLib.debug("set line %d to %m", eline, msg);
+                  // this.marks.set(eline, msg);
+               } );
+               return false;
+        
+        
+        
+        
+        
+               }
+        public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
+                 
+               this.error_line = validate_res.size;
+        
+               if (this.error_line < 1) {
+                       return true;
+               }
+               var tlines = this.el.get_line_count ();
+               Gtk.TextIter iter;
+               var valiter = validate_res.map_iterator();
+               while (valiter.next()) {
+        
+               //        print("get inter\n");
+                       var eline = valiter.get_key();
+                       if (eline > tlines) {
+                               continue;
+                       }
+                       this.el.get_iter_at_line( out iter, eline);
+                       //print("mark line\n");
+                       this.el.create_source_mark(valiter.get_value(), "ERR", iter);
+               }   
+               return false;
+        }
+        public string toString () {
+            
+            Gtk.TextIter s;
+            Gtk.TextIter e;
+            this.el.get_start_iter(out s);
+            this.el.get_end_iter(out e);
+            var ret = this.el.get_text(s,e,true);
+            //print("TO STRING? " + ret);
+            return ret;
+        }
+    }
+
+    public class Xcls_EventControllerKey11 : Object
+    {
+        public Gtk.EventControllerKey el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_EventControllerKey11(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.EventControllerKey();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            //listeners
+            this.el.key_released.connect( (keyval, keycode, state) => {
             
+              
+                if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+                    GLib.debug("SAVE: ctrl-S  pressed");
+                    _this.saveContents();
+                    return;
+                }
+                
+                if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+                   GLib.debug("SAVE: ctrl-g  pressed");
+                       _this.forwardSearch(true);
+                   return;
                }
-            public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
-                     
-               this.error_line = validate_res.size;
-            
-               if (this.error_line < 1) {
-                       return true;
+               if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+                   GLib.debug("SAVE: ctrl-f  pressed");
+                       _this.search_entry.el.grab_focus();
+                   return;
                }
-               var tlines = this.el.get_line_count ();
-               Gtk.TextIter iter;
-               var valiter = validate_res.map_iterator();
-               while (valiter.next()) {
-            
-               //        print("get inter\n");
-                       var eline = valiter.get_key();
-                       if (eline > tlines) {
-                               continue;
-                       }
-                       this.el.get_iter_at_line( out iter, eline);
-                       //print("mark line\n");
-                       this.el.create_source_mark(valiter.get_value(), "ERR", iter);
-               }   
-               return false;
-            }
-            public string toString () {
+                //_this.view.el.show_completion();
+               // print(event.key.keyval)
                 
-                Gtk.TextIter s;
-                Gtk.TextIter e;
-                this.el.get_start_iter(out s);
-                this.el.get_end_iter(out e);
-                var ret = this.el.get_text(s,e,true);
-                //print("TO STRING? " + ret);
-                return ret;
-            }
+                return;
+             
+             
+            });
         }
 
-        public class Xcls_EventControllerKey11 : Object
-        {
-            public Gtk.EventControllerKey el;
-            private Editor  _this;
+        // user defined functions
+    }
 
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_EventControllerKey11(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.EventControllerKey();
+    public class Xcls_Box12 : Object
+    {
+        public Gtk.Box el;
+        private Editor  _this;
 
-                // my vars (dec)
 
-                // set gobject values
+            // my vars (def)
 
-                //listeners
-                this.el.key_released.connect( (keyval, keycode, state) => {
-                
-                  
-                    if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
-                        GLib.debug("SAVE: ctrl-S  pressed");
-                        _this.saveContents();
-                        return;
-                    }
-                    
-                    if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
-                           GLib.debug("SAVE: ctrl-g  pressed");
-                               _this.forwardSearch(true);
-                           return;
-                       }
-                       if (keyval == Gdk.Key.f && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
-                           GLib.debug("SAVE: ctrl-f  pressed");
-                               _this.search_entry.el.grab_focus();
-                           return;
-                       }
-                    //_this.view.el.show_completion();
-                   // print(event.key.keyval)
-                    
-                    return;
-                 
-                 
-                });
-            }
+        // ctor
+        public Xcls_Box12(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            this.el.homogeneous = false;
+            this.el.vexpand = false;
+            var child_1 = new Xcls_search_entry( _this );
+            child_1.ref();
+            this.el.append( child_1.el );
+            var child_2 = new Xcls_search_results( _this );
+            child_2.ref();
+            this.el.append( child_2.el );
+            var child_3 = new Xcls_nextBtn( _this );
+            child_3.ref();
+            this.el.append( child_3.el );
+            var child_4 = new Xcls_backBtn( _this );
+            child_4.ref();
+            this.el.append( child_4.el );
+            var child_5 = new Xcls_MenuButton18( _this );
+            child_5.ref();
+            this.el.append( child_5.el );
         }
 
+        // user defined functions
+    }
+    public class Xcls_search_entry : Object
+    {
+        public Gtk.SearchEntry el;
+        private Editor  _this;
+
 
+            // my vars (def)
+        public Gtk.CssProvider css;
 
-        public class Xcls_Box12 : Object
+        // ctor
+        public Xcls_search_entry(Editor _owner )
         {
-            public Gtk.Box el;
-            private Editor  _this;
+            _this = _owner;
+            _this.search_entry = this;
+            this.el = new Gtk.SearchEntry();
 
+            // my vars (dec)
 
-                // my vars (def)
+            // set gobject values
+            this.el.name = "editor-search-entry";
+            this.el.hexpand = true;
+            this.el.placeholder_text = "Press enter to search";
+            this.el.search_delay = 3;
+            var child_1 = new Xcls_EventControllerKey14( _this );
+            child_1.ref();
+            this.el.add_controller(  child_1.el );
 
-            // ctor
-            public Xcls_Box12(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.homogeneous = false;
-                this.el.vexpand = false;
-                new Xcls_search_entry( _this );
-                this.el.append( _this.search_entry.el );
-                new Xcls_search_results( _this );
-                this.el.append( _this.search_results.el );
-                new Xcls_nextBtn( _this );
-                this.el.append( _this.nextBtn.el );
-                new Xcls_backBtn( _this );
-                this.el.append( _this.backBtn.el );
-                var child_5 = new Xcls_MenuButton18( _this );
-                child_5.ref();
-                this.el.append( child_5.el );
-            }
+            //listeners
+            this.el.search_changed.connect( ( ) => {
+            
+            _this.search(_this.search_entry.el.text);
+                _this.search_results.updateResults();
+            
+               GLib.Timeout.add_seconds(1,() => {
+                        _this.search_results.updateResults();
+                        return false;
+                });
+            });
+        }
 
-            // user defined functions
+        // user defined functions
+        public void forwardSearch (bool change_focus) {
+        
+        
+               _this.forwardSearch(change_focus);
+        
+        /*
+        
+               switch(_this.windowstate.state) {
+                       case WindowState.State.CODEONLY:
+                       //case WindowState.State.CODE:
+                               // search the code being edited..
+                               _this.windowstate.code_editor_tab.forwardSearch(change_focus);
+                                
+                               break;
+                       case WindowState.State.PREVIEW:
+                               if (_this.windowstate.file.xtype == "Gtk") {
+                                       _this.windowstate.window_gladeview.forwardSearch(change_focus);
+                               } else { 
+                                        _this.windowstate.window_rooview.forwardSearch(change_focus);
+                               }
+                       
+                               break;
+               }
+               */
+               
         }
-        public class Xcls_search_entry : Object
-        {
-            public Gtk.SearchEntry el;
-            private Editor  _this;
+    }
+    public class Xcls_EventControllerKey14 : Object
+    {
+        public Gtk.EventControllerKey el;
+        private Editor  _this;
 
 
-                // my vars (def)
-            public Gtk.CssProvider css;
+            // my vars (def)
 
-            // ctor
-            public Xcls_search_entry(Editor _owner )
-            {
-                _this = _owner;
-                _this.search_entry = this;
-                this.el = new Gtk.SearchEntry();
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.name = "editor-search-entry";
-                this.el.hexpand = true;
-                this.el.placeholder_text = "Press enter to search";
-                this.el.search_delay = 3;
-                var child_1 = new Xcls_EventControllerKey14( _this );
-                child_1.ref();
-                this.el.add_controller(  child_1.el );
-
-                //listeners
-                this.el.search_changed.connect( ( ) => {
-                
-                _this.search(_this.search_entry.el.text);
-                        _this.search_results.updateResults();
-                
-                       GLib.Timeout.add_seconds(1,() => {
-                                _this.search_results.updateResults();
-                                return false;
-                        });
-                });
-            }
+        // ctor
+        public Xcls_EventControllerKey14(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.EventControllerKey();
 
-            // user defined functions
-            public void forwardSearch (bool change_focus) {
-            
-            
-               _this.forwardSearch(change_focus);
-            
-            /*
+            // my vars (dec)
+
+            // set gobject values
+
+            //listeners
+            this.el.key_pressed.connect( (keyval, keycode, state) => {
             
-               switch(_this.windowstate.state) {
-                       case WindowState.State.CODEONLY:
-                       //case WindowState.State.CODE:
-                               // search the code being edited..
-                               _this.windowstate.code_editor_tab.forwardSearch(change_focus);
-                                
-                               break;
-                       case WindowState.State.PREVIEW:
-                               if (_this.windowstate.file.xtype == "Gtk") {
-                                       _this.windowstate.window_gladeview.forwardSearch(change_focus);
-                               } else { 
-                                        _this.windowstate.window_rooview.forwardSearch(change_focus);
-                               }
-                       
-                               break;
+               if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+                   GLib.debug("SAVE: ctrl-g  pressed");
+                       _this.forwardSearch(true);
+                   return true;
                }
-               */
-               
-            }
+                
+              
+               if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
+                       _this.forwardSearch(true);
+                       
+                       
+                   return true;
+            
+               }    
+               // print(event.key.keyval)
+               
+                return false;
+            });
         }
-        public class Xcls_EventControllerKey14 : Object
-        {
-            public Gtk.EventControllerKey el;
-            private Editor  _this;
 
+        // user defined functions
+    }
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_EventControllerKey14(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.EventControllerKey();
+    public class Xcls_search_results : Object
+    {
+        public Gtk.Label el;
+        private Editor  _this;
 
-                // my vars (dec)
 
-                // set gobject values
+            // my vars (def)
 
-                //listeners
-                this.el.key_pressed.connect( (keyval, keycode, state) => {
-                
-                       if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
-                           GLib.debug("SAVE: ctrl-g  pressed");
-                               _this.forwardSearch(true);
-                           return true;
-                       }
-                    
-                  
-                       if (keyval == Gdk.Key.Return && _this.search_entry.el.text.length > 0) {
-                               _this.forwardSearch(true);
-                               
-                               
-                           return true;
-                
-                       }    
-                   // print(event.key.keyval)
-                   
-                    return false;
-                });
-            }
+        // ctor
+        public Xcls_search_results(Editor _owner )
+        {
+            _this = _owner;
+            _this.search_results = this;
+            this.el = new Gtk.Label( "No Results" );
+
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            this.el.margin_end = 4;
+            this.el.margin_start = 4;
         }
 
+        // user defined functions
+        public void updateResults () {
+               this.el.visible = true;
+               
+               var res = _this.searchcontext.get_occurrences_count();
+               if (res < 0) {
+                       _this.search_results.el.label = "??? Matches";          
+                       return;
+               }
+        
+               _this.nextBtn.el.sensitive = false;
+               _this.backBtn.el.sensitive = false;     
+        
+               if (res > 0) {
+                       _this.search_results.el.label = "%d Matches".printf(res);
+                       _this.nextBtn.el.sensitive = true;
+                       _this.backBtn.el.sensitive = true;
+                       return;
+               } 
+               _this.search_results.el.label = "No Matches";
+               
+        }
+    }
 
-        public class Xcls_search_results : Object
-        {
-            public Gtk.Label el;
-            private Editor  _this;
+    public class Xcls_nextBtn : Object
+    {
+        public Gtk.Button el;
+        private Editor  _this;
 
 
-                // my vars (def)
+            // my vars (def)
+        public bool always_show_image;
 
-            // ctor
-            public Xcls_search_results(Editor _owner )
-            {
-                _this = _owner;
-                _this.search_results = this;
-                this.el = new Gtk.Label( "No Results" );
+        // ctor
+        public Xcls_nextBtn(Editor _owner )
+        {
+            _this = _owner;
+            _this.nextBtn = this;
+            this.el = new Gtk.Button();
 
-                // my vars (dec)
+            // my vars (dec)
+            this.always_show_image = true;
 
-                // set gobject values
-                this.el.margin_end = 4;
-                this.el.margin_start = 4;
-            }
+            // set gobject values
+            this.el.icon_name = "go-down";
+            this.el.sensitive = false;
 
-            // user defined functions
-            public void updateResults () {
-               this.el.visible = true;
-               
-               var res = _this.searchcontext.get_occurrences_count();
-               if (res < 0) {
-                       _this.search_results.el.label = "??? Matches";          
-                       return;
-               }
+            //listeners
+            this.el.clicked.connect( (event) => {
             
-               _this.nextBtn.el.sensitive = false;
-               _this.backBtn.el.sensitive = false;     
-            
-               if (res > 0) {
-                       _this.search_results.el.label = "%d Matches".printf(res);
-                       _this.nextBtn.el.sensitive = true;
-                       _this.backBtn.el.sensitive = true;
-                       return;
-               } 
-               _this.search_results.el.label = "No Matches";
+               _this.forwardSearch(true);
                
-            }
+                
+            });
         }
 
-        public class Xcls_nextBtn : Object
-        {
-            public Gtk.Button el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_backBtn : Object
+    {
+        public Gtk.Button el;
+        private Editor  _this;
 
-                // my vars (def)
-            public bool always_show_image;
 
-            // ctor
-            public Xcls_nextBtn(Editor _owner )
-            {
-                _this = _owner;
-                _this.nextBtn = this;
-                this.el = new Gtk.Button();
+            // my vars (def)
+        public bool always_show_image;
 
-                // my vars (dec)
-                this.always_show_image = true;
+        // ctor
+        public Xcls_backBtn(Editor _owner )
+        {
+            _this = _owner;
+            _this.backBtn = this;
+            this.el = new Gtk.Button();
 
-                // set gobject values
-                this.el.icon_name = "go-down";
-                this.el.sensitive = false;
+            // my vars (dec)
+            this.always_show_image = true;
 
-                //listeners
-                this.el.clicked.connect( (event) => {
-                
-                       _this.forwardSearch(true);
-                       
-                        
-                });
-            }
+            // set gobject values
+            this.el.icon_name = "go-up";
+            this.el.sensitive = false;
 
-            // user defined functions
+            //listeners
+            this.el.clicked.connect( (event) => {
+            
+               _this.backSearch(true);
+                
+            });
         }
 
-        public class Xcls_backBtn : Object
-        {
-            public Gtk.Button el;
-            private Editor  _this;
-
+        // user defined functions
+    }
 
-                // my vars (def)
-            public bool always_show_image;
+    public class Xcls_MenuButton18 : Object
+    {
+        public Gtk.MenuButton el;
+        private Editor  _this;
 
-            // ctor
-            public Xcls_backBtn(Editor _owner )
-            {
-                _this = _owner;
-                _this.backBtn = this;
-                this.el = new Gtk.Button();
 
-                // my vars (dec)
-                this.always_show_image = true;
+            // my vars (def)
+        public bool always_show_image;
 
-                // set gobject values
-                this.el.icon_name = "go-up";
-                this.el.sensitive = false;
+        // ctor
+        public Xcls_MenuButton18(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuButton();
 
-                //listeners
-                this.el.clicked.connect( (event) => {
-                
-                       _this.backSearch(true);
-                        
-                });
-            }
+            // my vars (dec)
+            this.always_show_image = true;
 
-            // user defined functions
+            // set gobject values
+            this.el.icon_name = "emblem-system";
+            this.el.always_show_arrow = true;
+            var child_1 = new Xcls_search_settings( _this );
+            child_1.ref();
+            this.el.popover = child_1.el;
         }
 
-        public class Xcls_MenuButton18 : Object
-        {
-            public Gtk.MenuButton el;
-            private Editor  _this;
-
+        // user defined functions
+    }
+    public class Xcls_search_settings : Object
+    {
+        public Gtk.Popover el;
+        private Editor  _this;
 
-                // my vars (def)
-            public bool always_show_image;
 
-            // ctor
-            public Xcls_MenuButton18(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.MenuButton();
+            // my vars (def)
 
-                // my vars (dec)
-                this.always_show_image = true;
+        // ctor
+        public Xcls_search_settings(Editor _owner )
+        {
+            _this = _owner;
+            _this.search_settings = this;
+            this.el = new Gtk.Popover();
 
-                // set gobject values
-                this.el.icon_name = "emblem-system";
-                this.el.always_show_arrow = true;
-                new Xcls_search_settings( _this );
-                this.el.popover = _this.search_settings.el;
-            }
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            var child_1 = new Xcls_Box20( _this );
+            child_1.ref();
+            this.el.child = child_1.el;
         }
-        public class Xcls_search_settings : Object
-        {
-            public Gtk.Popover el;
-            private Editor  _this;
 
+        // user defined functions
+    }
+    public class Xcls_Box20 : Object
+    {
+        public Gtk.Box el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_search_settings(Editor _owner )
-            {
-                _this = _owner;
-                _this.search_settings = this;
-                this.el = new Gtk.Popover();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_Box20(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
 
-                // set gobject values
-                var child_1 = new Xcls_Box20( _this );
-                this.el.child = child_1.el;
-            }
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            var child_1 = new Xcls_case_sensitive( _this );
+            child_1.ref();
+            this.el.append( child_1.el );
+            var child_2 = new Xcls_regex( _this );
+            child_2.ref();
+            this.el.append( child_2.el );
+            var child_3 = new Xcls_multiline( _this );
+            child_3.ref();
+            this.el.append( child_3.el );
         }
-        public class Xcls_Box20 : Object
-        {
-            public Gtk.Box el;
-            private Editor  _this;
 
+        // user defined functions
+    }
+    public class Xcls_case_sensitive : Object
+    {
+        public Gtk.CheckButton el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_Box20(Editor _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
-                // my vars (dec)
-
-                // set gobject values
-                new Xcls_case_sensitive( _this );
-                this.el.append( _this.case_sensitive.el );
-                new Xcls_regex( _this );
-                this.el.append( _this.regex.el );
-                new Xcls_multiline( _this );
-                this.el.append( _this.multiline.el );
-            }
+            // my vars (def)
 
-            // user defined functions
-        }
-        public class Xcls_case_sensitive : Object
+        // ctor
+        public Xcls_case_sensitive(Editor _owner )
         {
-            public Gtk.CheckButton el;
-            private Editor  _this;
+            _this = _owner;
+            _this.case_sensitive = this;
+            this.el = new Gtk.CheckButton();
 
+            // my vars (dec)
 
-                // my vars (def)
-
-            // ctor
-            public Xcls_case_sensitive(Editor _owner )
-            {
-                _this = _owner;
-                _this.case_sensitive = this;
-                this.el = new Gtk.CheckButton();
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.label = "Case Sensitive";
+            // set gobject values
+            this.el.label = "Case Sensitive";
 
-                // init method
+            // init method
 
-                {
-                       this.el.show();
-                }
+            {
+               this.el.show();
             }
-
-            // user defined functions
         }
 
-        public class Xcls_regex : Object
-        {
-            public Gtk.CheckButton el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_regex : Object
+    {
+        public Gtk.CheckButton el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_regex(Editor _owner )
-            {
-                _this = _owner;
-                _this.regex = this;
-                this.el = new Gtk.CheckButton();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_regex(Editor _owner )
+        {
+            _this = _owner;
+            _this.regex = this;
+            this.el = new Gtk.CheckButton();
+
+            // my vars (dec)
 
-                // set gobject values
-                this.el.label = "Regex";
+            // set gobject values
+            this.el.label = "Regex";
 
-                // init method
+            // init method
 
-                {
-                       this.el.show();
-                }
+            {
+               this.el.show();
             }
-
-            // user defined functions
         }
 
-        public class Xcls_multiline : Object
-        {
-            public Gtk.CheckButton el;
-            private Editor  _this;
+        // user defined functions
+    }
 
+    public class Xcls_multiline : Object
+    {
+        public Gtk.CheckButton el;
+        private Editor  _this;
 
-                // my vars (def)
 
-            // ctor
-            public Xcls_multiline(Editor _owner )
-            {
-                _this = _owner;
-                _this.multiline = this;
-                this.el = new Gtk.CheckButton();
+            // my vars (def)
 
-                // my vars (dec)
+        // ctor
+        public Xcls_multiline(Editor _owner )
+        {
+            _this = _owner;
+            _this.multiline = this;
+            this.el = new Gtk.CheckButton();
 
-                // set gobject values
-                this.el.label = "Multi-line (add \\n)";
-            }
+            // my vars (dec)
 
-            // user defined functions
+            // set gobject values
+            this.el.label = "Multi-line (add \\n)";
         }
 
+        // user defined functions
+    }
 
 
 
 
-    }
+
+}
index 7af7c18..b5c4f00 100644 (file)
@@ -23,7 +23,7 @@ namespace Lsp {
      * Defines how the host (editor) should sync document changes to the language server.
      */
     [CCode (default_value = "LSP_TEXT_DOCUMENT_SYNC_KIND_Unset")]
-    enum TextDocumentSyncKind {
+    public enum TextDocumentSyncKind {
         Unset = -1,
         /**
          * Documents should not be synced at all.
@@ -210,13 +210,13 @@ namespace Lsp {
      * An event describing a change to a text document. If range and rangeLength are omitted
      * the new text is considered to be the full content of the document.
      */
-    class TextDocumentContentChangeEvent : Object {
+    public class TextDocumentContentChangeEvent : Object {
         public Range? range    { get; set; }
         public int rangeLength { get; set; }
         public string text     { get; set; }
     }
 
-    enum MessageType {
+    public enum MessageType {
         /**
          * An error message.
          */
@@ -235,11 +235,11 @@ namespace Lsp {
         Log = 4
     }
 
-    class TextDocumentIdentifier : Object {
+    public class TextDocumentIdentifier : Object {
         public string uri { get; set; }
     }
 
-    class VersionedTextDocumentIdentifier : TextDocumentIdentifier {
+    public class VersionedTextDocumentIdentifier : TextDocumentIdentifier {
         /**
          * The version number of this document. If a versioned text document identifier
          * is sent from the server to the client and the file is not open in the editor
@@ -253,19 +253,19 @@ namespace Lsp {
         public int version { get; set; default = -1; }
     }
 
-    class TextDocumentPositionParams : Object {
+    public class TextDocumentPositionParams : Object {
         public TextDocumentIdentifier textDocument { get; set; }
         public Position position { get; set; }
     }
 
-    class ReferenceParams : TextDocumentPositionParams {
+    public class ReferenceParams : TextDocumentPositionParams {
         public class ReferenceContext : Object {
             public bool includeDeclaration { get; set; }
         }
         public ReferenceContext? context { get; set; }
     }
 
-    class Location : Object {
+    public class Location : Object {
         public string uri { get; set; }
         public Range range { get; set; }
 
@@ -280,22 +280,22 @@ namespace Lsp {
     }
 
     [CCode (default_value = "LSP_DOCUMENT_HIGHLIGHT_KIND_Text")]
-    enum DocumentHighlightKind {
+    public enum DocumentHighlightKind {
         Text = 1,
         Read = 2,
         Write = 3
     }
 
-    class DocumentHighlight : Object {
+    public class DocumentHighlight : Object {
         public Range range { get; set; }
         public DocumentHighlightKind kind { get; set; }
     }
 
-    class DocumentSymbolParams: Object {
+    public class DocumentSymbolParams: Object {
         public TextDocumentIdentifier textDocument { get; set; }
     }
 
-    class DocumentSymbol : Object, Json.Serializable {
+    public class DocumentSymbol : Object, Json.Serializable {
         private Vala.SourceReference? _source_reference;
         public string name { get; set; }
         public string? detail { get; set; }
@@ -371,7 +371,7 @@ namespace Lsp {
         }
     }
 
-    class SymbolInformation : Object {
+    public class SymbolInformation : Object {
         public string name { get; set; }
         public SymbolKind kind { get; set; }
         public Location location { get; set; }
@@ -386,7 +386,7 @@ namespace Lsp {
     }
 
     [CCode (default_value = "LSP_SYMBOL_KIND_Variable")]
-    enum SymbolKind {
+    public enum SymbolKind {
         File = 1,
         Module = 2,
         Namespace = 3,
@@ -415,7 +415,7 @@ namespace Lsp {
         TypeParameter = 26
     }
 
-    class CompletionList : Object, Json.Serializable {
+       public class CompletionList : Object, Json.Serializable {
         public bool isIncomplete { get; set; }
         public Gee.List<CompletionItem> items { get; private set; default = new Gee.LinkedList<CompletionItem> (); }
 
@@ -450,7 +450,7 @@ namespace Lsp {
     }
 
     [CCode (default_value = "LSP_COMPLETION_TRIGGER_KIND_Invoked")]
-    enum CompletionTriggerKind {
+    public enum CompletionTriggerKind {
         /**
             * Completion was triggered by typing an identifier (24x7 code
             * complete), manual invocation (e.g Ctrl+Space) or via API.
@@ -469,12 +469,12 @@ namespace Lsp {
         TriggerForIncompleteCompletions = 3
     }
 
-    class CompletionContext : Object {
+    public class CompletionContext : Object {
         public CompletionTriggerKind triggerKind { get; set;}
         public string? triggerCharacter { get; set; }
     }
 
-    class CompletionParams : TextDocumentPositionParams {
+    public class CompletionParams : TextDocumentPositionParams {
         /**
          * The completion context. This is only available if the client specifies
          * to send this using `ClientCapabilities.textDocument.completion.contextSupport === true`
@@ -482,13 +482,13 @@ namespace Lsp {
         public CompletionContext? context { get; set; }
     }
 
-    enum CompletionItemTag {
+    public enum CompletionItemTag {
         // Render a completion as obsolete, usually using a strike-out.
         Deprecated = 1,
     }
 
     [CCode (default_value = "LSP_INSERT_TEXT_FORMAT_PlainText")]
-    enum InsertTextFormat {
+    public enum InsertTextFormat {
         /**
          * The primary text to be inserted is treated as a plain string.
          */
@@ -505,7 +505,7 @@ namespace Lsp {
         Snippet = 2,
     }
 
-    class CompletionItem : Object, Gee.Hashable<CompletionItem>, Json.Serializable {
+    public class CompletionItem : Object, Gee.Hashable<CompletionItem>, Json.Serializable {
         public string label { get; set; }
         public CompletionItemKind kind { get; set; }
         public string detail { get; set; }
@@ -555,7 +555,7 @@ namespace Lsp {
             if (version != null && (version.get_bool ("deprecated") || version.get_string ("deprecated_since") != null)) {
                 this.tags.add (CompletionItemTag.Deprecated);
                 this.deprecated = true;
-            }
+            }public
         }
                */
         /**
@@ -630,13 +630,32 @@ namespace Lsp {
 
             return node;
         }
+        public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) 
+        {
+               if (property_name != "tags") {
+                return default_deserialize_property (property_name, out value, pspec, property_node);
+            }
+            if (property_node.get_node_type () != Json.NodeType.ARRAY) {
+                warning ("unexpected property node type for 'arguments' %s", property_node.get_node_type ().to_string ());
+                return false;
+            }
 
-        public bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Json.Node property_node) {
-            error ("deserialization not supported");
-        }
+            var arguments = new Gee.ArrayList<CompletionItemTag>();
+
+            property_node.get_array ().foreach_element ((array, index, element) => {
+                try {
+                    arguments.add ((CompletionItemTag) Json.gvariant_deserialize (element, null).get_int32() );
+                } catch (Error e) {
+                    warning ("argument %u to command could not be deserialized: %s", index, e.message);
+                }
+            });
+
+            value.set_boxed (arguments);
+            return true;
+       }
     }
 
-    class MarkupContent : Object {
+    public class MarkupContent : Object {
         public string kind { get; set; }
         public string value { get; set; }
 
@@ -660,7 +679,7 @@ namespace Lsp {
     }
     
     [CCode (default_value = "LSP_COMPLETION_ITEM_KIND_Text")]
-    enum CompletionItemKind {
+    public enum CompletionItemKind {
         Text = 1,
         Method = 2,
         Function = 3,
@@ -691,21 +710,21 @@ namespace Lsp {
     /**
      * Capabilities of the client/editor for `textDocument/documentSymbol`
      */
-    class DocumentSymbolCapabilities : Object {
+    public class DocumentSymbolCapabilities : Object {
         public bool hierarchicalDocumentSymbolSupport { get; set; }
     }
 
     /**
      * Capabilities of the client/editor for `textDocument/rename`
      */
-    class RenameClientCapabilities : Object {
+    public class RenameClientCapabilities : Object {
         public bool prepareSupport { get; set; }
     }
 
     /**
      * Capabilities of the client/editor pertaining to language features.
      */
-    class TextDocumentClientCapabilities : Object {
+    public class TextDocumentClientCapabilities : Object {
         public DocumentSymbolCapabilities documentSymbol { get; set; default = new DocumentSymbolCapabilities ();}
         public RenameClientCapabilities rename { get; set; default = new RenameClientCapabilities (); }
     }
@@ -713,18 +732,18 @@ namespace Lsp {
     /**
      * Capabilities of the client/editor.
      */
-    class ClientCapabilities : Object {
+    public class ClientCapabilities : Object {
         public TextDocumentClientCapabilities textDocument { get; set; default = new TextDocumentClientCapabilities (); }
     }
 
-    class InitializeParams : Object {
+    public class InitializeParams : Object {
         public int processId { get; set; }
         public string? rootPath { get; set; }
         public string? rootUri { get; set; }
         public ClientCapabilities capabilities { get; set; default = new ClientCapabilities (); }
     }
 
-    class SignatureInformation : Object, Json.Serializable {
+    public class SignatureInformation : Object, Json.Serializable {
         public string label { get; set; }
         public MarkupContent documentation { get; set; }
 
@@ -760,7 +779,7 @@ namespace Lsp {
         }
     }
 
-    class SignatureHelp : Object, Json.Serializable {
+    public class SignatureHelp : Object, Json.Serializable {
         public Gee.Collection<SignatureInformation> signatures { get; set; default = new Gee.ArrayList<SignatureInformation> (); }
         public int activeSignature { get; set; }
         public int activeParameter { get; set; }
@@ -782,17 +801,17 @@ namespace Lsp {
         }
     }
 
-    class ParameterInformation : Object {
+    public class ParameterInformation : Object {
         public string label { get; set; }
         public MarkupContent documentation { get; set; }
     }
 
-    class MarkedString : Object {
+   public  class MarkedString : Object {
         public string language { get; set; }
         public string value { get; set; }
     }
 
-    class Hover : Object, Json.Serializable {
+    public class Hover : Object, Json.Serializable {
         public Gee.List<MarkedString> contents { get; set; default = new Gee.ArrayList<MarkedString> (); }
         public Range range { get; set; }
 
@@ -833,7 +852,7 @@ namespace Lsp {
     /**
      * A textual edit applicable to a text document.
      */
-    class TextEdit : Object {
+    public class TextEdit : Object {
         /**
          * The range of the text document to be manipulated. To insert
          * text into a document create a range where ``start === end``.
@@ -861,7 +880,7 @@ namespace Lsp {
      * {@link TextDocumentEdit} doesn’t need to sort the array of edits or do any kind
      * of ordering. However the edits must be non overlapping.
      */
-    class TextDocumentEdit : Object, Json.Serializable {
+    public class TextDocumentEdit : Object, Json.Serializable {
         /**
          * The text document to change.
          */
@@ -894,7 +913,7 @@ namespace Lsp {
         }
     }
 
-    abstract class CommandLike : Object, Json.Serializable {
+    public abstract class CommandLike : Object, Json.Serializable {
         /**
          * The identifier of the actual command handler.
          */
@@ -954,7 +973,7 @@ namespace Lsp {
         }
     }
 
-    class ExecuteCommandParams : CommandLike {
+    public class ExecuteCommandParams : CommandLike {
     }
 
     /**
@@ -966,7 +985,7 @@ namespace Lsp {
      * handle the command. The protocol currently doesn’t specify a set of
      * well-known commands.
      */
-    class Command : CommandLike {
+    public class Command : CommandLike {
         /**
          * The title of the command, like `save`.
          */
@@ -981,7 +1000,7 @@ namespace Lsp {
      * performance reasons the creation of a code lens and resolving should be done
      * in two stages.
      */
-    class CodeLens : Object {
+    public class CodeLens : Object {
         /**
          * The range in which this code lens is valid. Should only span a single
          * line.
@@ -994,13 +1013,13 @@ namespace Lsp {
         public Command? command { get; set; }
     }
     
-    class DocumentRangeFormattingParams : Object {
+    public class DocumentRangeFormattingParams : Object {
         public TextDocumentIdentifier textDocument { get; set; }
         public Range? range { get; set; }
         public FormattingOptions options { get; set; }
     }
 
-    class FormattingOptions : Object {
+    public class FormattingOptions : Object {
         public uint tabSize { get; set; }
         public bool insertSpaces { get; set; }
         public bool trimTrailingWhitespace { get; set; }
@@ -1008,14 +1027,14 @@ namespace Lsp {
         public bool trimFinalNewlines { get; set; }
     }
 
-    class CodeActionParams : Object {
+    public class CodeActionParams : Object {
         public TextDocumentIdentifier textDocument { get; set; }
         public Range range { get; set; }
         public CodeActionContext context { get; set; }
     }
 
 
-    class CodeActionContext : Object, Json.Serializable {
+    public class CodeActionContext : Object, Json.Serializable {
         public Gee.List<Diagnostic> diagnostics { get; set; default = new Gee.ArrayList<Diagnostic> (); }
         public string[]? only { get; set; }
 /*
@@ -1082,7 +1101,7 @@ namespace Lsp {
        }
 
 
-    class CodeAction : Object, Json.Serializable {
+   public  class CodeAction : Object, Json.Serializable {
         public string title { get; set; }
         public string? kind { get; set; }
         public Gee.Collection<Diagnostic>? diagnostics { get; set; }
@@ -1109,7 +1128,7 @@ namespace Lsp {
         }
     }
 
-    class WorkspaceEdit : Object, Json.Serializable {
+    public class WorkspaceEdit : Object, Json.Serializable {
         public Gee.List<TextDocumentEdit>? documentChanges { get; set; }
 
         public Json.Node serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec) {
@@ -1129,12 +1148,12 @@ namespace Lsp {
     }
 
     [Flags]
-    enum SymbolTags {
+    public enum SymbolTags {
         NONE,
         DEPRECATED
     }
 
-    class CallHierarchyItem : Object, Json.Serializable {
+    public class CallHierarchyItem : Object, Json.Serializable {
         public string name { get; set; }
         public SymbolKind kind { get; set; }
         public SymbolTags tags { get; set; }
@@ -1182,7 +1201,7 @@ namespace Lsp {
         */
     }
 
-    class CallHierarchyIncomingCall : Json.Serializable, Object {
+    public class CallHierarchyIncomingCall : Json.Serializable, Object {
         /**
          * The method that calls the query method.
          */
@@ -1203,7 +1222,7 @@ namespace Lsp {
         }
     }
 
-    class CallHierarchyOutgoingCall : Json.Serializable, Object {
+    public class CallHierarchyOutgoingCall : Json.Serializable, Object {
         /**
          * The method that the query method calls.
          */
@@ -1224,18 +1243,18 @@ namespace Lsp {
         }
     }
 
-    class InlayHintParams : Json.Serializable, Object {
+    public class InlayHintParams : Json.Serializable, Object {
         public TextDocumentIdentifier textDocument { get; set; }
         public Range range { get; set; }
     }
 
-    enum InlayHintKind {
+    public enum InlayHintKind {
         UNSET,
         TYPE,
         PARAMETER
     }
 
-    class InlayHint : Object {
+    public class InlayHint : Object {
         public Position position { get; set; }
         public string label { get; set; }
         public InlayHintKind kind { get; set; }
@@ -1244,7 +1263,7 @@ namespace Lsp {
         public bool paddingRight { get; set; }
     }
 
-    class TypeHierarchyItem : Object, Json.Serializable {
+   public  class TypeHierarchyItem : Object, Json.Serializable {
         /**
          * The name of this item
          */
index 7c08df7..82465d6 100644 (file)
@@ -14,6 +14,7 @@ int main (string[] args) {
        var app =  BuilderApplication.singleton(  args);
          
     Gtk.init ();
+    GtkSource.init();
  
        
        // not sure why this was done?? - it caused crash bugs on gtk_Box_gadget so removed critical.
index b4b4de5..74cca1f 100644 (file)
@@ -14,6 +14,7 @@ namespace Palete {
                public Editor editor; 
                //public WindowState windowstate;
                public CompletionModel model;
+               global::Gtk.StringFilter filter;
 
                public CompletionProvider(Editor editor)
                {
@@ -45,8 +46,9 @@ namespace Palete {
                        }  
                        var buffer = begin.get_buffer();
                
-                       var  word = p.get_typed_text();
+                       var  word = p.label;
                        var len = -1;
+                       
 
                        /* If the insertion cursor is within a word and the trailing characters
                         * of the word match the suffix of the proposal, then limit how much
@@ -60,7 +62,9 @@ namespace Palete {
 
                                if (word_end.forward_word_end ()) {
                                        var text = end.get_slice(word_end);
-
+                                       if (text.length > word.length) {
+                                               return;
+                                       }
                                        if (word.has_suffix (text)) {
                                                //g_assert (strlen (word) >= strlen (text));
                                                len = word.length - text.length;
@@ -89,22 +93,23 @@ namespace Palete {
                {
                        GLib.debug("compelte display");
                        var col = cell.get_column();
-                       //var p = (CompletionProposal) proposal;
+                       
+                       var p = (CompletionProposal) proposal;
                        switch(col) {
                                case GtkSource.CompletionColumn.TYPED_TEXT:
-                                       cell.set_icon_name("completion-snippet-symbolic");
+                                       cell.set_text(p.label);
                                        break;
                                case GtkSource.CompletionColumn.ICON:
-                                       cell.set_text(cell.text);
+                                       cell.set_icon_name("completion-snippet-symbolic");
                                        break;
                                case  GtkSource.CompletionColumn.COMMENT:
-                                       cell.set_text(cell.text);
+                                       cell.set_text(p.info);
                                        break;
                                case GtkSource.CompletionColumn.DETAILS:
-                                       cell.set_text(cell.text);
+                                       cell.set_text(p.text);
                                        break;
                                default:
-                                       cell.set_text(cell.text);
+                                       cell.set_text(null);
                                        break;
                        }       
                }
@@ -114,51 +119,39 @@ namespace Palete {
                internal  async GLib.ListModel populate_async (GtkSource.CompletionContext context, GLib.Cancellable? cancellable)
                {
                        GLib.debug("pupoulate async");
+
                        global::Gtk.TextIter begin, end;
-                       
+                       Lsp.CompletionList res;
                        if (context.get_bounds (out begin, out end)) {
-                               yield this.file.getLanguageServer().completion(this.file, end.get_line(), end.get_line_offset());
+                               yield this.file.getLanguageServer().completion(this.file, end.get_line(), end.get_line_offset(), 1, out res);
+                       } else {
+                               res = null;
                        }
-                       this.model = new CompletionModel(this, context, cancellable); 
-                       return this.model;
+                       this.model = new CompletionModel(this, context, res, cancellable); 
+                       var word = context.get_word();
+                       
+                       
+                       var expression = new global::Gtk.PropertyExpression(typeof(CompletionProposal), null, "label");
+                       this.filter = new global::Gtk.StringFilter(expression);
+                       this.filter.set_search( word);
+                       var  filter_model = new global::Gtk.FilterListModel(this.model, this.filter); 
+                       filter.match_mode = global::Gtk.StringFilterMatchMode.PREFIX;
+                       filter_model.set_incremental(true);
+                       return filter_model; 
+                       
+                        
                        
                }
 
-               public  void refilter (GtkSource.CompletionContext context, GLib.ListModel in_model)
+               internal  void refilter (GtkSource.CompletionContext context, GLib.ListModel in_model)
                {
  
                        GLib.debug("pupoulate refilter");
-                       //GtkFilterListModel *filter_model = NULL;
-                       //G//tkExpression *expression = NULL;
-                       //GtkStringFilter *filter = NULL;
-                       //GListModel *replaced_model = NULL;
-                       //char *word;
-
-                       var model = in_model;
+        
 
                        var word = context.get_word();
-                       if (model is global::Gtk.FilterListModel) { 
-                               model = model.get_model ();
-                       }
-
-                       if (!this.model.can_filter(word)) {
-                               this.model.cancel(); 
-                               var replaced_model = new CompletionModel(this, context, this.model.cancellable);
-                               context.set_proposals_for_provider(this, replaced_model);
-                               
-                               context.set_proposals_for_provider(this, replaced_model);
-                               return;
-                       }
-                        
-                       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 global::Gtk.FilterListModel(in_model, filter); 
-                       filter_model.set_incremental(true);
-                       context.set_proposals_for_provider(this, filter_model); 
+                       this.filter.set_search(word);
                 
-
                
                }
 
@@ -193,36 +186,25 @@ namespace Palete {
                Gee.ArrayList<CompletionProposal> items;
                string search;
                int minimum_word_size = 2;
-               public Cancellable cancellable;
                
-               public CompletionModel(CompletionProvider provider, GtkSource.CompletionContext context, Cancellable cancellable)
+               public Cancellable? cancellable;
+               
+               public CompletionModel(CompletionProvider provider, GtkSource.CompletionContext context, Lsp.CompletionList? res, Cancellable? cancellable)
                {
                        this.provider = provider;
                        this.cancellable = cancellable;
                        this.items = new Gee.ArrayList<CompletionProposal>();
                        
-                       
-                       
-                       
-                       
-                       this.search = context.get_word();
-                   if (this.search.length < this.minimum_word_size) {
-                           return;
-                   }
-                   var prov  =  this.provider;
-                       
-                       if (prov.editor.window.windowstate == null) {
-                               GLib.debug("Warning - provider windowstate not set?");
-                               return;
-                       }
-                   // now do our magic..
-                   this.items = prov.editor.window.windowstate.file.palete().suggestComplete(
-                           prov.editor.window.windowstate.file,
-                           prov.editor.node,
-                           prov.editor.prop,
-                           this.search
-                   ); 
-               
+                       var word = context.get_word();
+                       GLib.debug("looking for %s", word);
+                       this.search = word;
+                       if (res != null) {
+                               foreach(var comp in res.items) {
+                                        
+                                       this.items.add(new CompletionProposal(comp));   
+                                       
+                               }
+                       }
                    print("GOT %d results\n", (int) items.size); 
                        // WHY TWICE?
                    if (this.items.size < this.minimum_word_size) {
@@ -262,11 +244,14 @@ namespace Palete {
                        /* If the new word starts with our initial word, then we can simply
                         * refilter outside this model using a GtkFilterListModel.
                         */
+                        
                         return word.has_prefix(this.search); 
                }
                public void  cancel ()
                {
-                       this.cancellable.cancel();
+                       if (this.cancellable != null) {
+                               this.cancellable.cancel();
+                       }
                }
 
 
@@ -275,15 +260,18 @@ namespace Palete {
        public class CompletionProposal : Object, GtkSource.CompletionProposal 
        {
                
-               string label;
+               public string label { get; set; default = ""; }
                
-               public string text;
-               string info;
-               public CompletionProposal(string label, string text, string info)
+               public string text  { get; set; default = ""; }
+               public string info  { get; set; default = ""; }
+               public CompletionProposal(Lsp.CompletionItem ci) //string label, string text, string info)
                {
-                       this.text = text;
-                       this.label = label;
-                       this.info = info;
+                       
+                       
+                       this.text = ci.detail == null ? "" : ci.detail ;
+                       this.label = ci.label;
+                       this.info = ci.documentation == null ? "": ci.documentation.value;
+                       GLib.debug("SET: text=%s, label = %s; info =%s", ci.detail, ci.label, "to long..");
                }
                
        }
index 9d17b09..53873b2 100644 (file)
@@ -673,6 +673,8 @@ namespace Palete {
                ) { 
                        
                        var ret =  new Gee.ArrayList<CompletionProposal>();
+                       return ret;
+                       /*
                        // completion rules??
                        
                        // make sure data is loaded
@@ -911,6 +913,7 @@ namespace Palete {
                        
                        
                        return ret;
+                       */
                }
                
                
index 23c0f4e..d3dd092 100644 (file)
@@ -292,11 +292,14 @@ namespace Palete {
                
                @triggerType 1 = typing or ctl-spac, 2 = tiggercharactres?  3= inside completion?
                */
-                public async GLib.Object? completion (JsRender.JsRender file, int line, int offset , int triggerType = 1) throws GLib.Error 
+                public async void completion (JsRender.JsRender file, int line, int offset , int triggerType = 1, out Lsp.CompletionList? ret) throws GLib.Error 
                 {
                        /* partial_result_token ,  work_done_token   context = null) */
+                       GLib.debug("get completion %s @ %d:%d", file.relpath, line, offset);
+                       
+                       ret = null;
                    if (!this.isReady()) {
-                               return null;
+                               return;
                        }
                        Variant? return_value;
                        yield this.jsonrpc_client.call_async (
@@ -320,23 +323,21 @@ namespace Palete {
                        );
                        
                        
-                       GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));                                       
+                       //GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));                                     
                        var json = Json.gvariant_serialize (return_value);
                        var ar = json.get_array();
-                       var cl = new Lsp.CompletionList();
-                       if (ar == null) {
-                               cl = Json.gobject_deserialize (typeof (Lsp.CompletionList), json) as Lsp.CompletionList; 
 
-                       } else {
-                               
-                               for(var i = 0; i < ar.get_length(); i++ ) {
-                                       var add= Json.gobject_deserialize ( typeof (Lsp.CompletionItem),  ar.get_element(i)) as Lsp.CompletionItem;
-                                       cl.items.add( add);
-                                                
-                               }
-                                
-                       }
-                       return null;
+                       if (ar == null) {
+                               ret = Json.gobject_deserialize (typeof (Lsp.CompletionList), json) as Lsp.CompletionList; 
+                               return;
+                       }  
+                       ret = new Lsp.CompletionList(); 
+                       for(var i = 0; i < ar.get_length(); i++ ) {
+                               var add= Json.gobject_deserialize ( typeof (Lsp.CompletionItem),  ar.get_element(i)) as Lsp.CompletionItem;
+                               ret.items.add( add);
+                                        
+                       }
+                                 
                        
                
 
index 82515c3..e0b9131 100644 (file)
@@ -381,6 +381,8 @@ namespace Palete {
                ) { 
                        
                        var ret =  new Gee.ArrayList<CompletionProposal>();
+                       return ret;
+                       /*
                        // completion rules??
                        
                        // Roo......
@@ -566,6 +568,7 @@ namespace Palete {
                        
                        
                        return ret;
+                       */
                }