Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/SymbolPane/C/CtagsSymbolOutline.vala
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,42 @@ public class Scratch.Services.CtagsSymbolOutline : Scratch.Services.SymbolOutlin
destroy_root (root);
root = new_root;

add_tooltips (store.root);
return false;
});
}

protected override void add_tooltips (Code.Widgets.SourceList.ExpandableItem root) {
foreach (var parent in root.children) {
if (parent is Code.Widgets.SourceList.ExpandableItem) {
add_tooltip ((Code.Widgets.SourceList.ExpandableItem) parent);
}
}
}

private void add_tooltip (Code.Widgets.SourceList.ExpandableItem parent) {
if (parent is CtagsSymbol) {
var item = ((CtagsSymbol)parent);
var start = item.line;
var end = item.line;
// The type of a method is often on the previous line
if (item.symbol_type == SymbolType.METHOD) {
start = start > 0 ? start - 1 : start;
}

item.tooltip = Markup.escape_text ("%s".printf (
doc.get_slice (
start,
0,
end,
0
)
));
}

add_tooltips (parent);
}

private void destroy_root (Code.Widgets.SourceList.ExpandableItem to_destroy) {
var children = iterate_children (to_destroy);
to_destroy.clear ();
Expand Down