Merge branch 'master' of http://git.roojs.com/roobuilder
[roobuilder] / src / Builder4 / Editor.vala
index da17b3e..825f993 100644 (file)
@@ -12,11 +12,14 @@ public class Editor : Object
                }
                return _Editor;
        }
+       public Xcls_paned paned;
        public Xcls_save_button save_button;
+       public Xcls_helper helper;
        public Xcls_close_btn close_btn;
        public Xcls_RightEditor RightEditor;
        public Xcls_view view;
        public Xcls_buffer buffer;
+       public Xcls_keystate keystate;
        public Xcls_search_entry search_entry;
        public Xcls_search_results search_results;
        public Xcls_nextBtn nextBtn;
@@ -25,6 +28,12 @@ public class Editor : Object
        public Xcls_case_sensitive case_sensitive;
        public Xcls_regex regex;
        public Xcls_multiline multiline;
+       public Xcls_navigation_holder navigation_holder;
+       public Xcls_navigationwindow navigationwindow;
+       public Xcls_navigation navigation;
+       public Xcls_navigationselmodel navigationselmodel;
+       public Xcls_navigationsort navigationsort;
+       public Xcls_navliststore navliststore;
 
                // my vars (def)
        public int pos_root_x;
@@ -57,20 +66,14 @@ public class Editor : Object
                this.file = null;
                this.node = null;
                this.prop = null;
-               this.activeEditor = "";
+               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 );
-               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  );
+               new Xcls_paned( _this );
+               this.el.append( _this.paned.el );
        }
 
        // user defined functions
@@ -137,20 +140,38 @@ public class Editor : Object
        public void show (JsRender.JsRender file, JsRender.Node? node, JsRender.NodeProp? prop)
        {
            this.reset();
+           if (this.file != null) {
+               this.file.navigation_tree_updated.disconnect(
+                       _this.navigation.show
+               );
+           }
            this.file = file;    
-           
+           this.file.navigation_tree_updated.connect(
+                       _this.navigation.show
+               );
            if (file.xtype != "PlainFile") {
                this.prop = prop;
                this.node = node;
        
                // find the text for the node..
                this.view.load( prop.val );
-       
+               this.updateErrorMarks();
+               
+               
+               
                this.close_btn.el.show();       
            
            } else {
                this.view.load(        file.toSource() );
+               this.updateErrorMarks();
                this.close_btn.el.hide();
+               var ls = file.getLanguageServer();
+               ls.queueDocumentSymbols(file);
+               ////ls.documentSymbols.begin(file, (a,o) => {
+               //      _this.navigation.show(ls.documentSymbols.end(o)); 
+              //});
+               //documentSymbols
+               
            }
         
        }
@@ -158,7 +179,7 @@ public class Editor : Object
        
                if (this.searchcontext == null) {
                        return;
-               } 
+               }
                
                Gtk.TextIter beg, st,en;
                bool has_wrapped_around;
@@ -274,7 +295,12 @@ public class Editor : Object
                }
                var ar = this.file.getErrors();
                if (ar.size < 1) {
-                       buf.remove_source_marks (start, end, null);
+                       buf.remove_source_marks (start, end, "ERR");
+                       buf.remove_source_marks (start, end, "WARN");
+                       buf.remove_source_marks (start, end, "DEPR");
+                       buf.remove_tag_by_name ("ERR", start, end);
+                       buf.remove_tag_by_name ("WARN", start, end);
+                       buf.remove_tag_by_name ("DEPR", start, end);
                        this.last_error_counter = file.error_counter ;
                        //GLib.debug("highlight %s :  %s has no errors", this.file.relpath, category);
                        return;
@@ -296,7 +322,7 @@ public class Editor : Object
        
                        tlines = _this.prop.end_line;
                        offset = _this.prop.start_line;
-                       hoffset = _this.node.node_pad.length;
+                       hoffset = _this.node.node_pad.length + 2; //shift it left  by 2 ? ..
                        
                         
                } else {
@@ -307,27 +333,50 @@ public class Editor : Object
                        }
                
                }
-               buf.remove_source_marks (start, end, null);
+               buf.remove_source_marks (start, end, "ERR");
+               buf.remove_source_marks (start, end, "WARN");
+               buf.remove_source_marks (start, end, "DEPR");
+               buf.remove_tag_by_name ("ERR", start, end);
+               buf.remove_tag_by_name ("WARN", start, end);
+               buf.remove_tag_by_name ("DEPR", start, end);
+               
                foreach(var diag in ar) { 
                     Gtk.TextIter iter;
        //        print("get inter\n");
                    var eline = (int)diag.range.start.line - offset;
+                   var eline_to = (int)diag.range.end.line - offset;
                    //var eline =  diag.range.end_line - offset;
                    //GLib.debug("GOT ERROR on line %d -- converted to %d  (offset = %d)",
                    //  err.line ,eline, offset);
                    
                    
                    if (eline > tlines || eline < 0) {
-       
                        continue;
                    }
-                  
                    
-                   buf.get_iter_at_line_offset( out iter, eline, (int)diag.range.start.character - hoffset);
-                  
-                  
-                       var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
+                   buf.get_iter_at_line( out iter, eline);
+                       var msg = "Line: %d %s : %s".printf(eline+1, diag.category, diag.message);
                    buf.create_source_mark( msg, diag.category, iter);
+                   
+                   var spos = (int)diag.range.start.character - hoffset;
+                   if (spos < 0) { spos =0 ; }
+                   if (spos > iter.get_chars_in_line()) {
+                       spos = iter.get_chars_in_line();
+               }
+                       buf.get_iter_at_line( out iter, eline_to);
+                       var epos = (int)diag.range.end.character - hoffset;
+                   if (epos < 0) { epos =0 ; }
+                   if (epos > iter.get_chars_in_line()) {
+                       epos = iter.get_chars_in_line();
+               }
+                    
+                   
+                   buf.get_iter_at_line_offset( out start, eline, spos); 
+                  
+                   buf.get_iter_at_line_offset( out end, eline_to,epos); 
+                       
+                   buf.apply_tag_by_name(diag.category, start, end);
+                   
                   // GLib.debug("set line %d to %s", eline, msg);
                    //this.marks.set(eline, msg);
                }
@@ -353,6 +402,37 @@ public class Editor : Object
                        return false;
                });   
        }
+       public class Xcls_paned : Object
+       {
+               public Gtk.Paned el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_paned(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.paned = this;
+                       this.el = new Gtk.Paned( Gtk.Orientation.HORIZONTAL );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.resize_start_child = false;
+                       this.el.shrink_end_child = false;
+                       this.el.resize_end_child = false;
+                       this.el.shrink_start_child = false;
+                       var child_1 = new Xcls_Box2( _this );
+                       child_1.ref();
+                       this.el.start_child = child_1.el;
+                       new Xcls_navigation_holder( _this );
+                       this.el.end_child = _this.navigation_holder.el;
+               }
+
+               // user defined functions
+       }
        public class Xcls_Box2 : Object
        {
                public Gtk.Box el;
@@ -363,6 +443,36 @@ public class Editor : Object
 
                // ctor
                public Xcls_Box2(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.hexpand = true;
+                       var child_1 = new Xcls_Box3( _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_Box15( _this );
+                       child_3.ref();
+                       this.el.append ( child_3.el  );
+               }
+
+               // user defined functions
+       }
+       public class Xcls_Box3 : Object
+       {
+               public Gtk.Box el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_Box3(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -371,13 +481,13 @@ public class Editor : Object
 
                        // set gobject values
                        this.el.homogeneous = false;
-                       this.el.hexpand = true;
+                       this.el.hexpand = false;
+                       this.el.vexpand = false;
                        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 );
+                       new Xcls_helper( _this );
+                       this.el.append( _this.helper.el );
+                       var child_3 = new Xcls_Scale6( _this );
                        child_3.ref();
                        this.el.append( child_3.el );
                        new Xcls_close_btn( _this );
@@ -404,6 +514,7 @@ public class Editor : Object
                        // my vars (dec)
 
                        // set gobject values
+                       this.el.vexpand = true;
                        this.el.label = "Save";
 
                        //listeners
@@ -415,7 +526,7 @@ public class Editor : Object
                // user defined functions
        }
 
-       public class Xcls_Label4 : Object
+       public class Xcls_helper : Object
        {
                public Gtk.Label el;
                private Editor  _this;
@@ -424,21 +535,86 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Label4(Editor _owner )
+               public Xcls_helper(Editor _owner )
                {
                        _this = _owner;
+                       _this.helper = this;
                        this.el = new Gtk.Label( null );
 
                        // my vars (dec)
 
                        // set gobject values
+                       this.el.margin_end = 4;
+                       this.el.margin_start = 4;
+                       this.el.justify = Gtk.Justification.LEFT;
                        this.el.hexpand = true;
+                       this.el.xalign = 0f;
+
+                       //listeners
+                       this.el.query_tooltip.connect( (x, y, keyboard_tooltip, tooltip) => {
+                               GLib.debug("using quiery tooltip?");
+                               var lbl = new Gtk.Label(this.el.tooltip_markup);
+                               lbl.width_request = 500;
+                               tooltip.set_custom(lbl);
+                       
+                               return true;
+                       });
+                       this.el.activate_link.connect( (uri) => {
+                               GLib.debug("got uri %s", uri);
+                               var ls = _this.file.getLanguageServer();
+                               ls.symbol.begin(uri, (a,b) => {
+                                       ls.symbol.end(b);
+                               });
+                               
+                               return true;
+                       });
                }
 
                // user defined functions
+               public void setHelp (Lsp.Hover? help) {
+                       if (help == null || help.contents == null
+                               || help.contents.size < 1) {
+                               this.el.set_text("");
+                               return;
+                       }
+                       var sig = help.contents.get(0).value.split(" ");
+                       string[] str = {};
+                       for(var i =0; i < sig.length; i++) {
+                       
+                               switch(sig[i]) {
+                                       case "public":
+                                       case "private":
+                                       case "protected":
+                                       case "async":
+                                       case "class":
+                                       case "{":
+                                       case "}":
+                                       case "(":
+                                       case ")":
+                                       
+                                               str += sig[i];
+                                               continue;
+                                               
+                                               
+                                       default:
+                       
+                                               str += ("<a href=\"" + GLib.Markup.escape_text(sig[i]) + "\">" + 
+                                                       GLib.Markup.escape_text(sig[i])
+                                                       +"</a>");
+                                       continue;
+                               }
+                       }
+                       if (help.contents.size > 1) {
+                               this.el.tooltip_markup =  GLib.Markup.escape_text(help.contents.get(1).value);
+                       } else {
+                               this.el.tooltip_markup = GLib.Markup.escape_text(help.contents.get(0).value);
+                       }
+                       this.el.set_markup(string.joinv(" ",str));
+                       
+               }
        }
 
-       public class Xcls_Scale5 : Object
+       public class Xcls_Scale6 : Object
        {
                public Gtk.Scale el;
                private Editor  _this;
@@ -447,7 +623,7 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Scale5(Editor _owner )
+               public Xcls_Scale6(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1);
@@ -455,8 +631,9 @@ public class Editor : Object
                        // my vars (dec)
 
                        // set gobject values
-                       this.el.width_request = 200;
+                       this.el.width_request = 150;
                        this.el.has_origin = true;
+                       this.el.halign = Gtk.Align.END;
                        this.el.draw_value = false;
                        this.el.digits = 0;
                        this.el.sensitive = true;
@@ -464,18 +641,26 @@ public class Editor : Object
                        // init method
 
                        {
-                               this.el.set_range(6,30);
-                               this.el.set_value(8);
+                               //this.el.set_range(6,30);
+                               this.el.set_value ( BuilderApplication.settings.editor_font_size);
+                               BuilderApplication.settings.editor_font_size_updated.connect(
+                                       () => {
+                                               BuilderApplication.settings.editor_font_size_inchange = true;
+                                       //      GLib.debug("update range");
+                                               this.el.set_value (BuilderApplication.settings.editor_font_size);
+                                               BuilderApplication.settings.editor_font_size_inchange = false;
+                                       }
+                               );
+                               
+                        
                        }
 
                        //listeners
                        this.el.change_value.connect( (st, val ) => {
-                                
-                                  
-                                 _this.view.css.load_from_string(
-                                               "#editor-view { font: %dpx monospace; }".printf((int)val)
-                                  );
-                            
+                               if (BuilderApplication.settings.editor_font_size_inchange) {
+                                       return false;
+                               }
+                               BuilderApplication.settings.editor_font_size = val;
                                return false;
                        });
                }
@@ -502,7 +687,9 @@ public class Editor : Object
 
                        // set gobject values
                        this.el.icon_name = "window-close";
-                       var child_1 = new Xcls_Image7( _this );
+                       this.el.halign = Gtk.Align.END;
+                       var child_1 = new Xcls_Image8( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners
@@ -514,7 +701,7 @@ public class Editor : Object
 
                // user defined functions
        }
-       public class Xcls_Image7 : Object
+       public class Xcls_Image8 : Object
        {
                public Gtk.Image el;
                private Editor  _this;
@@ -523,7 +710,7 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Image7(Editor _owner )
+               public Xcls_Image8(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Image();
@@ -597,52 +784,37 @@ public class Editor : Object
                        this.el.hexpand = true;
                        this.el.vexpand = true;
                        this.el.has_tooltip = true;
+                       this.el.css_classes = { "code-editor" };
                        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 );
+                       new Xcls_keystate( _this );
+                       this.el.add_controller(  _this.keystate.el );
+                       var child_3 = new Xcls_EventControllerScroll13( _this );
+                       child_3.ref();
+                       this.el.add_controller(  child_3.el );
+                       var child_4 = new Xcls_GestureClick14( _this );
+                       child_4.ref();
+                       this.el.add_controller(  child_4.el );
 
                        // init method
 
-                       this.css = new Gtk.CssProvider();
-                       
-                       this.css.load_from_string(
-                               "#editor-view { font:  12px monospace;}"
+                       this.el.completion.add_provider(
+                               new Palete.CompletionProvider(_this)
                        );
-                        
-                       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));
-                         
+                       
+                       // hover seems pretty useless.. - ??
+                       //var hover = this.el.get_hover();
+                       //hover.add_provider(new Palete.HoverProvider(_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);
@@ -654,10 +826,9 @@ public class Editor : Object
                        });
                        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);
+                       
+                       
+                       var wattrs = new GtkSource.MarkAttributes();
                        wattrs.set_icon_name ( "process-stop");    
                        wattrs.query_tooltip_text.connect(( mark) => {
                             GLib.debug("tooltip query? %s", mark.name);
@@ -670,20 +841,19 @@ public class Editor : Object
                        this.el.set_mark_attributes ("WARN", wattrs, 1);
                        wattrs.ref();
                        
+                        
+                       var dattrs = new GtkSource.MarkAttributes();
+                        
+                       dattrs.set_icon_name ( "process-stop"); 
                        
-                        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);
-                       });
+                       //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();    
                        
@@ -793,8 +963,6 @@ public class Editor : Object
                    this.el.grab_focus();
                    _this.save_button.el.sensitive = false;
                    _this.last_error_counter = -1;
-                       _this.updateErrorMarks();
-                   
                }
        }
        public class Xcls_buffer : Object
@@ -827,20 +995,35 @@ public class Editor : Object
 
                        // init method
 
-                       {
-                               var buf = this.el;
-                               buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
-                           buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
-                           buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
-                           buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
-                           buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
-                           buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
-                           buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
-                           buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
+                       var buf = this.el;
+                       buf.create_tag ("bold", "weight", Pango.Weight.BOLD);
+                       buf.create_tag ("type", "weight", Pango.Weight.BOLD, "foreground", "#204a87");
+                       buf.create_tag ("keyword", "weight", Pango.Weight.BOLD, "foreground", "#a40000");
+                       buf.create_tag ("text", "weight", Pango.Weight.NORMAL, "foreground", "#729fcf");
+                       buf.create_tag ("number", "weight", Pango.Weight.BOLD, "foreground", "#ad7fa8");
+                       buf.create_tag ("method", "weight", Pango.Weight.BOLD, "foreground", "#729fcf");
+                       buf.create_tag ("property", "weight", Pango.Weight.BOLD, "foreground", "#BC1F51");
+                       buf.create_tag ("variable", "weight", Pango.Weight.BOLD, "foreground", "#A518B5");
                        
-                       }
+                       
+                       buf.create_tag ("ERR", "weight", Pango.Weight.BOLD, "background", "pink");
+                       buf.create_tag ("WARN", "weight", Pango.Weight.BOLD, "background", "#ABF4EB");
+                       buf.create_tag ("DEPR", "weight", Pango.Weight.BOLD, "background", "#EEA9FF");
 
                        //listeners
+                       this.el.cursor_moved.connect( ( ) => {
+                       
+                               Gtk.TextIter iter;
+                               this.el.get_iter_at_offset (
+                                               out iter, this.el.cursor_position);
+                       
+                               _this.navigation.updateSelectedLine(
+                                               (uint)iter.get_line(),
+                                               (uint)iter.get_line_offset()
+                                       );
+                               this.showHelp(iter);
+                       
+                       });
                        this.el.changed.connect( () => {
                            // check syntax??
                            // ??needed..??
@@ -856,66 +1039,7 @@ public class Editor : Object
                }
 
                // 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);
-                           BuilderApplication.showSpinner("appointment soon","document change pending");
-                       _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.node.updated_count++;
-                   _this.file.getLanguageServer().document_change(_this.file);
-                   _this.node.updated_count++;
-                   _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) {
+               public bool OLDhighlightErrorsJson (string type, Json.Object obj) {
                        Gtk.TextIter start;
                        Gtk.TextIter end;     
                        this.el.get_bounds (out start, out end);
@@ -1026,6 +1150,65 @@ public class Editor : Object
                
                
                        }
+               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);
+                           BuilderApplication.showSpinner("appointment soon","document change pending");
+                       _this.file.getLanguageServer().document_change(_this.file);
+                               _this.file.getLanguageServer().queueDocumentSymbols(_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.node.updated_count++;
+                   _this.file.getLanguageServer().document_change(_this.file);
+                   _this.node.updated_count++;
+                   _this.prop.val = oldcode;
+                   
+                   
+                   //print("done mark line\n");
+                    
+                   return true; // at present allow saving - even if it's invalid..
+               }
                public bool highlightErrors ( Gee.HashMap<int,string> validate_res) {
                         
                        this.error_line = validate_res.size;
@@ -1059,30 +1242,74 @@ public class Editor : Object
                    //print("TO STRING? " + ret);
                    return ret;
                }
+               public void showHelp (Gtk.TextIter iter) {
+                       var back = iter.copy();
+                       back.backward_char();
+                       
+                       var forward = iter.copy();
+                       forward.forward_char();
+                       
+                       // what's the character at the iter?
+                       var str = back.get_text(iter);
+                       str += iter.get_text(forward);
+                       if (str.strip().length < 1) {
+                               return;
+                       }
+                       var offset = iter.get_line_offset();
+                       var line = iter.get_line();
+                       if (_this.prop != null) {
+                                               // 
+                               line += _this.prop.start_line ; 
+                                                       // this is based on Gtk using tabs (hence 1/2 chars);
+                               offset += _this.node.node_pad.length;
+                                                       // javascript listeners are indented 2 more spaces.
+                               if (_this.prop.ptype == JsRender.NodePropType.LISTENER) {
+                                       offset += 2;
+                               }
+                       } 
+                       
+                       var ls = _this.file.getLanguageServer();
+                       ls.hover.begin(
+                               _this.file, line, offset,
+                               ( a, o)  => {
+                                       try {
+                                               var res = ls.hover.end(o );
+                                       
+                                               _this.helper.setHelp(res);
+                                       } catch (GLib.Error e) {
+                                               // noop..
+                                       }
+                               });
+               }
        }
 
-       public class Xcls_EventControllerKey11 : Object
+       public class Xcls_keystate : Object
        {
                public Gtk.EventControllerKey el;
                private Editor  _this;
 
 
                        // my vars (def)
+               public bool is_control;
 
                // ctor
-               public Xcls_EventControllerKey11(Editor _owner )
+               public Xcls_keystate(Editor _owner )
                {
                        _this = _owner;
+                       _this.keystate = this;
                        this.el = new Gtk.EventControllerKey();
 
                        // my vars (dec)
+                       this.is_control = false;
 
                        // set gobject values
 
                        //listeners
                        this.el.key_released.connect( (keyval, keycode, state) => {
                        
-                         
+                                if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
+                                       this.is_control = false;
+                               }
                            if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
                                GLib.debug("SAVE: ctrl-S  pressed");
                                _this.saveContents();
@@ -1116,22 +1343,121 @@ public class Editor : Object
                                } 
                            //_this.view.el.show_completion();
                           // print(event.key.keyval)
-                          
-                          
-                          
+                           
                            
                            return;
                         
                         
                        });
+                       this.el.key_pressed.connect( (keyval, keycode, state) => {
+                       
+                               if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
+                                       this.is_control = true;
+                               }
+                               return false;
+                       });
                }
 
                // user defined functions
        }
 
+       public class Xcls_EventControllerScroll13 : Object
+       {
+               public Gtk.EventControllerScroll el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+               public double distance;
+
+               // ctor
+               public Xcls_EventControllerScroll13(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.EventControllerScroll( Gtk.EventControllerScrollFlags.VERTICAL );
+
+                       // my vars (dec)
+                       this.distance = 0.0f;
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.scroll.connect( (dx, dy) => {
+                               if (!_this.keystate.is_control) {
+                                       return false;
+                               }
+                                //GLib.debug("scroll %f",  dy);
+                               
+                               this.distance += dy;
+                               
+                               //GLib.debug("scroll %f / %f",  dy, this.distance);
+                        
+                                if (this.distance < -1) {
+                        
+                                       BuilderApplication.settings.editor_font_size ++;
+                                       this.distance = 0;
+                               }
+                               if (this.distance > 1) {
+                                       BuilderApplication.settings.editor_font_size --;
+                                       this.distance = 0;
+                               }
+                                
+                               return true;
+                       });
+               }
+
+               // user defined functions
+       }
+
+       public class Xcls_GestureClick14 : Object
+       {
+               public Gtk.GestureClick el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_GestureClick14(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.GestureClick();
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.pressed.connect( (n_press, x, y) => {
+                               Gtk.TextIter iter;
+                               int  buffer_x, buffer_y;
+                               var gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);
+                               
+                                _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,
+                                       (int)x - gut.get_width(),  (int)y,
+                                       out  buffer_x, out  buffer_y);
+                               _this.view.el.get_iter_at_location (out  iter,  
+                                               buffer_x,  buffer_y);;
+                               
+                               
+                               if (_this.buffer.el.iter_has_context_class(iter, "comment") ||
+                                       _this.buffer.el.iter_has_context_class(iter, "string")
+                               ) { 
+                                       return ;
+                               }
+                               _this.buffer.showHelp(iter);
+                                
+                                        
+                        
+                       });
+               }
 
-
-       public class Xcls_Box12 : Object
+               // user defined functions
+       }
+
+
+
+       public class Xcls_Box15 : Object
        {
                public Gtk.Box el;
                private Editor  _this;
@@ -1140,7 +1466,7 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box12(Editor _owner )
+               public Xcls_Box15(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -1158,7 +1484,7 @@ public class Editor : Object
                        this.el.append( _this.nextBtn.el );
                        new Xcls_backBtn( _this );
                        this.el.append( _this.backBtn.el );
-                       var child_5 = new Xcls_MenuButton18( _this );
+                       var child_5 = new Xcls_MenuButton21( _this );
                        child_5.ref();
                        this.el.append( child_5.el );
                }
@@ -1188,7 +1514,7 @@ public class Editor : Object
                        this.el.hexpand = true;
                        this.el.placeholder_text = "Press enter to search";
                        this.el.search_delay = 3;
-                       var child_1 = new Xcls_EventControllerKey14( _this );
+                       var child_1 = new Xcls_EventControllerKey17( _this );
                        child_1.ref();
                        this.el.add_controller(  child_1.el );
 
@@ -1233,7 +1559,7 @@ public class Editor : Object
                        
                }
        }
-       public class Xcls_EventControllerKey14 : Object
+       public class Xcls_EventControllerKey17 : Object
        {
                public Gtk.EventControllerKey el;
                private Editor  _this;
@@ -1242,7 +1568,7 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_EventControllerKey14(Editor _owner )
+               public Xcls_EventControllerKey17(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.EventControllerKey();
@@ -1393,7 +1719,7 @@ public class Editor : Object
                // user defined functions
        }
 
-       public class Xcls_MenuButton18 : Object
+       public class Xcls_MenuButton21 : Object
        {
                public Gtk.MenuButton el;
                private Editor  _this;
@@ -1403,7 +1729,7 @@ public class Editor : Object
                public bool always_show_image;
 
                // ctor
-               public Xcls_MenuButton18(Editor _owner )
+               public Xcls_MenuButton21(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.MenuButton();
@@ -1438,13 +1764,14 @@ public class Editor : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_Box20( _this );
+                       var child_1 = new Xcls_Box23( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
                }
 
                // user defined functions
        }
-       public class Xcls_Box20 : Object
+       public class Xcls_Box23 : Object
        {
                public Gtk.Box el;
                private Editor  _this;
@@ -1453,7 +1780,7 @@ public class Editor : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box20(Editor _owner )
+               public Xcls_Box23(Editor _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -1559,4 +1886,710 @@ public class Editor : Object
 
 
 
+
+       public class Xcls_navigation_holder : Object
+       {
+               public Gtk.Box el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_navigation_holder(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navigation_holder = this;
+                       this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.width_request = 120;
+                       this.el.hexpand = true;
+                       this.el.vexpand = true;
+                       this.el.visible = false;
+                       var child_1 = new Xcls_Box28( _this );
+                       child_1.ref();
+                       this.el.append( child_1.el );
+                       new Xcls_navigationwindow( _this );
+                       this.el.append( _this.navigationwindow.el );
+               }
+
+               // user defined functions
+       }
+       public class Xcls_Box28 : Object
+       {
+               public Gtk.Box el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_Box28(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+
+       public class Xcls_navigationwindow : Object
+       {
+               public Gtk.ScrolledWindow el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_navigationwindow(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navigationwindow = this;
+                       this.el = new Gtk.ScrolledWindow();
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.hexpand = true;
+                       this.el.vexpand = true;
+                       this.el.visible = true;
+                       new Xcls_navigation( _this );
+                       this.el.child = _this.navigation.el;
+               }
+
+               // user defined functions
+       }
+       public class Xcls_navigation : Object
+       {
+               public Gtk.ColumnView el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+               public int last_selected_line;
+               public Gtk.Widget? selected_row;
+
+               // ctor
+               public Xcls_navigation(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navigation = this;
+                       new Xcls_navigationselmodel( _this );
+                       this.el = new Gtk.ColumnView( _this.navigationselmodel.el );
+
+                       // my vars (dec)
+                       this.last_selected_line = -1;
+                       this.selected_row = null;
+
+                       // set gobject values
+                       this.el.name = "editor-navigation";
+                       var child_2 = new Xcls_ColumnViewColumn31( _this );
+                       child_2.ref();
+                       this.el.append_column( child_2.el );
+                       var child_3 = new Xcls_GestureClick40( _this );
+                       child_3.ref();
+                       this.el.add_controller(  child_3.el );
+               }
+
+               // user defined functions
+               public Gtk.Widget? getRowWidgetAt (double x,  double  y, out string pos) {
+               
+                       pos = "";
+                       var w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);
+                       //GLib.debug("got widget %s", w == null ? "nothing" : w.get_type().name());
+                       if (w == null) {
+                               return null;
+                       }
+                       
+                       var row= w.get_ancestor(GLib.Type.from_name("GtkColumnViewRowWidget"));
+                       if (row == null) {
+                               return null;
+                       }
+                       
+                       //GLib.debug("got colview %s", row == null ? "nothing" : row.get_type().name());
+                        
+                
+                       
+                       //GLib.debug("row number is %d", rn);
+                       //GLib.debug("click %d, %d", (int)x, (int)y);
+                       // above or belw
+                       Graphene.Rect  bounds;
+                       row.compute_bounds(this.el, out bounds);
+                       //GLib.debug("click x=%d, y=%d, w=%d, h=%d", 
+                       //      (int)bounds.get_x(), (int)bounds.get_y(),
+                       //      (int)bounds.get_width(), (int)bounds.get_height()
+                       //      );
+                       var ypos = y - bounds.get_y();
+                       //GLib.debug("rel ypos = %d", (int)ypos);       
+                       var rpos = 100.0 * (ypos / bounds.get_height());
+                       //GLib.debug("rel pos = %d %%", (int)rpos);
+                       pos = "over";
+                       
+                       if (rpos > 80) {
+                               pos = "below";
+                       } else if (rpos < 20) {
+                               pos = "above";
+                       } 
+                       return row;
+                }
+               public void show (Gee.ArrayList<Lsp.DocumentSymbol> syms) {
+                       
+                       if (!_this.navigation_holder.el.visible && syms.size > 0) {
+                               _this.navigation_holder.el.show();
+                               _this.paned.el.position  = 
+                                       _this.paned.el.get_width() - 200;
+                       } 
+                       //_this.navliststore.el.remove_all();
+                       
+                       
+                       var ls  = new GLib.ListStore(typeof(Lsp.DocumentSymbol));
+                       
+                       foreach(var sym in syms) {
+                               ls.append(sym);
+                       }
+                       // if syms updated is empty, but we already have one..
+                       if (_this.navliststore.el.get_n_items() > 0 && ls.get_n_items() < 1) {
+                               return;
+                       }
+                       Lsp.DocumentSymbol.copyList(ls, _this.navliststore.el);
+                       //_this.navliststore.el.append(sym);
+                       this.last_selected_line = -1;
+                       GLib.Idle.add(() => {
+                               _this.navigationsort.collapseOnLoad();
+                               Gtk.TextIter iter;
+                               _this.buffer.el.get_iter_at_offset (
+                                               out iter, _this.buffer.el.cursor_position);
+                               
+                               GLib.debug("idle update scroll %d, %d", iter.get_line(),
+                                               iter.get_line_offset());
+                               this.updateSelectedLine(
+                                               (uint)iter.get_line(),
+                                               (uint)iter.get_line_offset()
+                               );
+                               return false;
+                       });
+               
+               }
+               public int getRowAt (double x,  double  y, out string pos) {
+               
+                       pos = "";
+                       var w = this.el.pick(x, y, Gtk.PickFlags.DEFAULT);
+                       //GLib.debug("got widget %s", w == null ? "nothing" : w.get_type().name());
+                       if (w == null) {
+                               return -1;
+                       }
+                       
+                       var row= w.get_ancestor(GLib.Type.from_name("GtkColumnViewRowWidget"));
+                       if (row == null) {
+                               return -1;
+                       }
+                       
+                       //GLib.debug("got colview %s", row == null ? "nothing" : row.get_type().name());
+                        
+                       var rn = 0;
+                       var cr = row;
+                        
+                       while (cr.get_prev_sibling() != null) {
+                               rn++;
+                               cr = cr.get_prev_sibling();
+                       }
+                       
+                       //GLib.debug("row number is %d", rn);
+                       //GLib.debug("click %d, %d", (int)x, (int)y);
+                       // above or belw
+                       Graphene.Rect  bounds;
+                       row.compute_bounds(this.el, out bounds);
+                       //GLib.debug("click x=%d, y=%d, w=%d, h=%d", 
+                       //      (int)bounds.get_x(), (int)bounds.get_y(),
+                       //      (int)bounds.get_width(), (int)bounds.get_height()
+                       //      );
+                       var ypos = y - bounds.get_y();
+                       //GLib.debug("rel ypos = %d", (int)ypos);       
+                       var rpos = 100.0 * (ypos / bounds.get_height());
+                       //GLib.debug("rel pos = %d %%", (int)rpos);
+                       pos = "over";
+                       
+                       if (rpos > 80) {
+                               pos = "below";
+                       } else if (rpos < 20) {
+                               pos = "above";
+                       } 
+                       return rn;
+                }
+               public void updateSelectedLine (uint line, uint chr) {
+                       if (line == this.last_selected_line) {
+                               return;
+                       }
+                       GLib.debug("select line %d", (int)line);
+                       this.last_selected_line = (int)line;
+                       
+                       
+                       var new_row = -1;
+                       var sym = _this.navliststore.symbolAtLine(line, chr);
+                       if (sym != null) {
+                               new_row = _this.navigationsort.getRowFromSymbol(sym);
+                               GLib.debug("select line %d - row found %d", (int)line, new_row);
+                       } else {
+                               GLib.debug(" no symbol found at line %d", (int)line);
+                       }
+                       
+                       if (this.selected_row != null) { 
+                               GLib.debug(" remove selected row");
+                               this.selected_row.remove_css_class("selected-row");
+                       }
+                       this.selected_row  = null;
+                       if (new_row > -1) {
+                               this.el.scroll_to(new_row,null,Gtk.ListScrollFlags.NONE, null);
+                               var row = sym.get_data<Gtk.Widget>("widget");
+                               if (row != null) {
+                                       GLib.debug(" Add selected row");
+                                       
+                                       row.add_css_class("selected-row");
+                                       this.selected_row = row;
+               
+                                       
+                               } else {
+                                       GLib.debug("could not find widget on row %d", new_row);
+                               }
+               
+                       }
+               
+               
+               }
+       }
+       public class Xcls_ColumnViewColumn31 : Object
+       {
+               public Gtk.ColumnViewColumn el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_ColumnViewColumn31(Editor _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_SignalListItemFactory32( _this );
+                       child_1.ref();
+                       this.el = new Gtk.ColumnViewColumn( "Code Navigation", child_1.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.expand = true;
+               }
+
+               // user defined functions
+       }
+       public class Xcls_SignalListItemFactory32 : Object
+       {
+               public Gtk.SignalListItemFactory el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_SignalListItemFactory32(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.SignalListItemFactory();
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.setup.connect( (listitem) => {
+                               
+                               var expand = new Gtk.TreeExpander();
+                                
+                               expand.set_indent_for_depth(true);
+                               expand.set_indent_for_icon(true);
+                               var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+                               var icon = new Gtk.Image();
+                               var lbl = new Gtk.Label("");
+                               lbl.use_markup = true;
+                               lbl.ellipsize = Pango.EllipsizeMode.END;
+                               
+                               icon.margin_end = 4;
+                               lbl.justify = Gtk.Justification.LEFT;
+                               lbl.xalign = 0;
+                       
+                       //      listitem.activatable = true; ??
+                               
+                               hbox.append(icon);
+                               hbox.append(lbl);
+                               expand.set_child(hbox);
+                               ((Gtk.ListItem)listitem).set_child(expand);
+                               
+                       });
+                       this.el.bind.connect( (listitem) => {
+                                
+                               // GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+                               
+                               //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+                               var expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();
+                                
+                                
+                               var hbox = (Gtk.Box) expand.child;
+                        
+                               
+                               var img = (Gtk.Image) hbox.get_first_child();
+                               var lbl = (Gtk.Label) img.get_next_sibling();
+                               
+                               var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+                               var sym = (Lsp.DocumentSymbol) lr.get_item();
+                               
+                               sym.set_data<Gtk.Widget>("widget", expand.get_parent());
+                               expand.get_parent().get_parent().set_data<Lsp.DocumentSymbol>("symbol", sym);
+                               
+                               //GLib.debug("save sym on %s", expand.get_parent().get_parent().get_type().name());
+                               
+                               //GLib.debug("got %d children for %s" , (int)sym.children.get_n_items(), sym.name);
+                           
+                           expand.set_hide_expander( sym.children.get_n_items()  < 1);
+                               expand.set_list_row(lr);
+                               //this.in_bind = true;
+                               // default is to expand
+                        
+                               //this.in_bind = false;
+                               
+                               sym.bind_property("symbol_icon",
+                                           img, "icon_name",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               
+                               hbox.css_classes = { sym.symbol_icon };
+                               
+                               sym.bind_property("name",
+                                           lbl, "label",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               // should be better?- --line no?
+                               sym.bind_property("tooltip",
+                                           lbl, "tooltip_markup",
+                                          GLib.BindingFlags.SYNC_CREATE);
+                               // bind image...
+                               
+                       });
+               }
+
+               // user defined functions
+       }
+
+
+       public class Xcls_navigationselmodel : Object
+       {
+               public Gtk.NoSelection el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_navigationselmodel(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navigationselmodel = this;
+                       new Xcls_navigationsort( _this );
+                       this.el = new Gtk.NoSelection( _this.navigationsort.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+       public class Xcls_navigationsort : Object
+       {
+               public Gtk.SortListModel el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_navigationsort(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navigationsort = this;
+                       var child_1 = new Xcls_TreeListModel35( _this );
+                       child_1.ref();
+                       var child_2 = new Xcls_TreeListRowSorter37( _this );
+                       child_2.ref();
+                       this.el = new Gtk.SortListModel( child_1.el, child_2.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+               public void collapseOnLoad () {
+                       for (var i=0;i < this.el.get_n_items(); i++) {
+                               var tr = (Gtk.TreeListRow)this.el.get_item(i);
+                               var sym =  (Lsp.DocumentSymbol)tr.get_item();
+                               switch (sym.kind) {
+                                       case Lsp.SymbolKind.Enum: 
+                                               tr.expanded = false;
+                                               break;
+                                       default:
+                                               //tr.expanded = true;
+                                               break;
+                               }
+                       }
+                
+                       
+               
+               
+               }
+               public int getRowFromSymbol (Lsp.DocumentSymbol sym) {
+               
+                       for (var i=0;i < this.el.get_n_items(); i++) {
+                               var tr = (Gtk.TreeListRow)this.el.get_item(i);
+                          
+                               if (sym.equals( (Lsp.DocumentSymbol)tr.get_item())) {
+                                       return i;
+                               }
+                       }
+                       return -1;
+               }
+               public Lsp.DocumentSymbol? getSymbolAt (uint row) {
+               
+                  var tr = (Gtk.TreeListRow)this.el.get_item(row);
+                  
+                  var a = tr.get_item();;   
+                  GLib.debug("get_item (2) = %s", a.get_type().name());
+                       
+                  
+                  return (Lsp.DocumentSymbol)tr.get_item();
+                        
+               }
+       }
+       public class Xcls_TreeListModel35 : Object
+       {
+               public Gtk.TreeListModel el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_TreeListModel35(Editor _owner )
+               {
+                       _this = _owner;
+                       new Xcls_navliststore( _this );
+                       this.el = new Gtk.TreeListModel( _this.navliststore.el, false, true, (item) => {
+       return ((Lsp.DocumentSymbol)item).children;
+}
+ );
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.items_changed.connect( (position, removed, added) => {
+                               GLib.debug("tree item changed %d , %d , %d",(int) position, (int)removed, (int) added);
+                                if (added < 1) { 
+                                       return;
+                               }
+                               //var sym = (Lsp.DocumentSymbol) this.el.get_item(position);
+                               var row = this.el.get_row(position);
+                               
+                               GLib.debug("got %s", row.get_item().get_type().name());
+                               
+                       
+                       });
+               }
+
+               // user defined functions
+       }
+       public class Xcls_navliststore : Object
+       {
+               public GLib.ListStore el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_navliststore(Editor _owner )
+               {
+                       _this = _owner;
+                       _this.navliststore = this;
+                       this.el = new GLib.ListStore( typeof(Lsp.DocumentSymbol) );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+               public Lsp.DocumentSymbol? symbolAtLine (uint line, uint chr) {
+                
+                       
+                       for(var i = 0; i < this.el.get_n_items();i++) {
+                               var el = (Lsp.DocumentSymbol)this.el.get_item(i);
+                               //GLib.debug("Check sym %s : %d-%d",
+                               //      el.name , (int)el.range.start.line,
+                               //      (int)el.range.end.line
+                               //);
+                               var ret = el.containsLine(line,chr);
+                               if (ret != null) {
+                                       return ret;
+                               }
+                               
+                       }
+                       
+                       return null;
+               }
+       }
+
+
+       public class Xcls_TreeListRowSorter37 : Object
+       {
+               public Gtk.TreeListRowSorter el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_TreeListRowSorter37(Editor _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_StringSorter38( _this );
+                       child_1.ref();
+                       this.el = new Gtk.TreeListRowSorter( child_1.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+       public class Xcls_StringSorter38 : Object
+       {
+               public Gtk.StringSorter el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_StringSorter38(Editor _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_PropertyExpression39( _this );
+                       child_1.ref();
+                       this.el = new Gtk.StringSorter( child_1.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+       public class Xcls_PropertyExpression39 : Object
+       {
+               public Gtk.PropertyExpression el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_PropertyExpression39(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.PropertyExpression( typeof(Lsp.DocumentSymbol), null, "sort_key" );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+
+
+
+
+
+       public class Xcls_GestureClick40 : Object
+       {
+               public Gtk.GestureClick el;
+               private Editor  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_GestureClick40(Editor _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.GestureClick();
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.pressed.connect( (n_press, x, y) => {
+                               string pos;
+                               var row = _this.navigation.getRowWidgetAt(x,y, out pos );
+                       
+                           if (row == null) {
+                                   GLib.debug("no row selected items");
+                                   return;
+                           }
+                               GLib.debug("got click on %s", row.get_type().name());    
+                           //Lsp.DocumentSymbol
+                           var sym =  row.get_data<Lsp.DocumentSymbol>("symbol");
+                           if (sym == null) {
+                               return;
+                               }
+                               /*
+                                "range" : {
+                                     "start" : {
+                                       "line" : 1410,
+                                       "character" : 8
+                                     },
+                                     "end" : {
+                                       "line" : 1410,
+                                       "character" : 39
+                                     }
+                                   },
+                               */
+                            GLib.debug("goto line %d",   (int)sym.range.start.line); 
+                           _this.scroll_to_line((int)sym.range.start.line);
+                           Gtk.TextIter iter;
+                           _this.buffer.el.get_iter_at_line_offset(out iter, 
+                               (int)sym.range.start.line,
+                               (int)sym.range.start.character
+                               );
+                           _this.buffer.el.place_cursor(iter);
+                               
+                       });
+               }
+
+               // user defined functions
+       }
+
+
+
+
+
 }