|
|
@@ -306,7 +306,10 @@ public class TextFormatter : Object, OutputFormatter {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- builder.append ("%s:\n".printf (title));
|
|
|
+ // Calculate maximum display name length for proper alignment
|
|
|
+ int max_name_length = 0;
|
|
|
+ var symbol_data = new Gee.ArrayList<SymbolData> ();
|
|
|
+
|
|
|
foreach (Symbol symbol in symbols) {
|
|
|
string full_path = symbol.get_full_path ();
|
|
|
string display_name;
|
|
|
@@ -318,7 +321,24 @@ public class TextFormatter : Object, OutputFormatter {
|
|
|
display_name = full_path;
|
|
|
}
|
|
|
|
|
|
- builder.append (" %-30s %s\n".printf (display_name, symbol.access_modifier));
|
|
|
+ // Track maximum name length
|
|
|
+ if (display_name.length > max_name_length) {
|
|
|
+ max_name_length = display_name.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Store symbol data for formatting
|
|
|
+ var data = new SymbolData ();
|
|
|
+ data.display_name = display_name;
|
|
|
+ data.access_modifier = symbol.access_modifier;
|
|
|
+ symbol_data.add (data);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Ensure minimum width for name column
|
|
|
+ int name_width = int.max (max_name_length, 25);
|
|
|
+
|
|
|
+ builder.append ("%s:\n".printf (title));
|
|
|
+ foreach (SymbolData data in symbol_data) {
|
|
|
+ builder.append (" %-*s %s\n".printf (name_width, data.display_name, data.access_modifier));
|
|
|
}
|
|
|
builder.append ("\n");
|
|
|
}
|
|
|
@@ -383,13 +403,34 @@ public class TextFormatter : Object, OutputFormatter {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- builder.append ("%s:\n".printf (title));
|
|
|
+ // Separate methods and other symbols for different formatting
|
|
|
+ var methods = new Gee.ArrayList<Symbol> ();
|
|
|
+ var other_symbols = new Gee.ArrayList<Symbol> ();
|
|
|
+
|
|
|
foreach (Symbol symbol in symbols) {
|
|
|
- // Special handling for methods to show detailed signatures
|
|
|
if (symbol.symbol_type == "method") {
|
|
|
- string method_sig = format_method_signature ((Method) symbol);
|
|
|
- builder.append (" %s\n".printf (method_sig));
|
|
|
+ methods.add (symbol);
|
|
|
} else {
|
|
|
+ other_symbols.add (symbol);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ builder.append ("%s:\n".printf (title));
|
|
|
+
|
|
|
+ // Format methods first (they use full signature formatting)
|
|
|
+ foreach (Symbol symbol in methods) {
|
|
|
+ Method method = (Method) symbol;
|
|
|
+ string method_sig = format_method_signature (method);
|
|
|
+ builder.append (" %s\n".printf (method_sig));
|
|
|
+ }
|
|
|
+
|
|
|
+ // Format other symbols with proper column alignment
|
|
|
+ if (other_symbols.size > 0) {
|
|
|
+ // Calculate maximum display name length for proper alignment
|
|
|
+ int max_name_length = 0;
|
|
|
+ var symbol_data = new Gee.ArrayList<SymbolData> ();
|
|
|
+
|
|
|
+ foreach (Symbol symbol in other_symbols) {
|
|
|
string full_path = symbol.get_full_path ();
|
|
|
string display_name;
|
|
|
|
|
|
@@ -400,9 +441,34 @@ public class TextFormatter : Object, OutputFormatter {
|
|
|
display_name = full_path;
|
|
|
}
|
|
|
|
|
|
- builder.append (" %-30s %s\n".printf (display_name, symbol.access_modifier));
|
|
|
+ // Track maximum name length
|
|
|
+ if (display_name.length > max_name_length) {
|
|
|
+ max_name_length = display_name.length;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Store symbol data for formatting
|
|
|
+ var data = new SymbolData ();
|
|
|
+ data.display_name = display_name;
|
|
|
+ data.access_modifier = symbol.access_modifier;
|
|
|
+ symbol_data.add (data);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Ensure minimum width for name column
|
|
|
+ int name_width = int.max (max_name_length, 25);
|
|
|
+
|
|
|
+ foreach (SymbolData data in symbol_data) {
|
|
|
+ builder.append (" %-*s %s\n".printf (name_width, data.display_name, data.access_modifier));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
builder.append ("\n");
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Helper class to store symbol information for formatting.
|
|
|
+ */
|
|
|
+private class SymbolData : Object {
|
|
|
+ public string display_name { get; set; default = ""; }
|
|
|
+ public string access_modifier { get; set; default = ""; }
|
|
|
}
|