File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -275,10 +275,42 @@ public class Scratch.Services.CtagsSymbolOutline : Scratch.Services.SymbolOutlin
275275 destroy_root (root);
276276 root = new_root;
277277
278+ add_tooltips (store. root);
278279 return false ;
279280 });
280281 }
281282
283+ protected override void add_tooltips (Code .Widgets .SourceList .ExpandableItem root ) {
284+ foreach (var parent in root. children) {
285+ if (parent is Code . Widgets . SourceList . ExpandableItem ) {
286+ add_tooltip ((Code . Widgets . SourceList . ExpandableItem ) parent);
287+ }
288+ }
289+ }
290+
291+ private void add_tooltip (Code .Widgets .SourceList .ExpandableItem parent ) {
292+ if (parent is CtagsSymbol ) {
293+ var item = ((CtagsSymbol )parent);
294+ var start = item. line;
295+ var end = item. line;
296+ // The type of a method is often on the previous line
297+ if (item. symbol_type == SymbolType . METHOD ) {
298+ start = start > 0 ? start - 1 : start;
299+ }
300+
301+ item. tooltip = Markup . escape_text (" %s " . printf (
302+ doc. get_slice (
303+ start,
304+ 0 ,
305+ end,
306+ 0
307+ )
308+ ));
309+ }
310+
311+ add_tooltips (parent);
312+ }
313+
282314 private void destroy_root (Code .Widgets .SourceList .ExpandableItem to_destroy ) {
283315 var children = iterate_children (to_destroy);
284316 to_destroy. clear ();
You can’t perform that action at this time.
0 commit comments