@@ -133,8 +133,8 @@ public class Scratch.Services.ValaSymbolOutline : Scratch.Services.SymbolOutline
133133 }
134134
135135 store. root. expand_all ();
136+ add_tooltips (store. root);
136137 store. vadjustment. set_value (adjustment_value);
137-
138138 return false ;
139139 });
140140 } else {
@@ -145,6 +145,30 @@ public class Scratch.Services.ValaSymbolOutline : Scratch.Services.SymbolOutline
145145 });
146146 }
147147
148+ protected override void add_tooltips (Code . Widgets . SourceList . ExpandableItem root) {
149+ foreach (var parent in root. children) {
150+ add_tooltip ((Code . Widgets . SourceList . ExpandableItem ) parent);
151+ }
152+ }
153+
154+ private void add_tooltip (Code . Widgets . SourceList . ExpandableItem parent) {
155+ if (parent is ValaSymbolItem ) {
156+ var item = ((ValaSymbolItem )parent);
157+ var symbol = item. symbol;
158+ item. tooltip = " %s%s " . printf (
159+ doc. get_slice (
160+ symbol. source_reference. begin. line,
161+ symbol. source_reference. begin. column,
162+ symbol. source_reference. end. line,
163+ symbol. source_reference. end. column
164+ ),
165+ symbol. comment != null ? " \n " + symbol. comment. content : " "
166+ );
167+ }
168+
169+ add_tooltips (parent);
170+ }
171+
148172 private void destroy_all_children (Code . Widgets . SourceList . ExpandableItem parent) {
149173 foreach (var child in parent. children) {
150174 remove (child, parent);
@@ -177,7 +201,9 @@ public class Scratch.Services.ValaSymbolOutline : Scratch.Services.SymbolOutline
177201 continue ;
178202
179203 construct_child (symbol, new_root, cancellable);
180- Thread . yield ();
204+ if (! cancellable. is_cancelled ()) {
205+ Thread . yield ();
206+ }
181207 }
182208
183209 return new_root;
@@ -199,19 +225,10 @@ public class Scratch.Services.ValaSymbolOutline : Scratch.Services.SymbolOutline
199225 parent = construct_child (symbol. scope. parent_scope. owner, given_parent, cancellable);
200226 }
201227
202- var tooltip = " %s%s " . printf (
203- doc. get_slice (
204- symbol. source_reference. begin. line,
205- symbol. source_reference. begin. column,
206- symbol. source_reference. end. line,
207- symbol. source_reference. end. column
208- ),
209- symbol. comment != null ? " \n " + symbol. comment. content : " "
210- );
211228
212229 var tree_child = new ValaSymbolItem (
213230 symbol,
214- tooltip
231+ " "
215232 );
216233 parent. add (tree_child);
217234 return tree_child;
0 commit comments