info method

  1. @override
SymbolInfo? info([
  1. String? name
])
override

Show details and suggestions for a symbol. Maps to: info [name]

If name is null, shows general info. If name is a package name, shows package details.

Implementation

@override
SymbolInfo? info([String? name]) {
  if (name == null) {
    return SymbolInfo(
      name: toolName,
      kind: SymbolKind.package,
      documentation: 'Use info <name> to get information about a symbol.',
    );
  }

  // Try to find the symbol in configuration
  final config = _d4rt.getConfiguration();

  // Check bridged classes from all imports
  for (final imp in config.imports) {
    for (final cls in imp.classes) {
      if (cls.name == name) {
        return SymbolInfo(
          name: name,
          kind: SymbolKind.class_,
          documentation: 'Bridged class: ${cls.name}',
          details: {
            'methods': cls.methods,
            'constructors': cls.constructors,
          },
        );
      }
    }

    // Check bridged enums
    for (final e in imp.enums) {
      if (e.name == name) {
        return SymbolInfo(
          name: name,
          kind: SymbolKind.enum_,
          documentation: 'Bridged enum: ${e.name}',
          details: {'values': e.values},
        );
      }
    }
  }

  return null;
}