diff --git a/lib/main.dart b/lib/main.dart index 44b4bc8..88b6d10 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -27,7 +27,7 @@ import 'widgets/widgets.dart'; /// Studio's own build version. Bump on every UI commit so the /// running app self-identifies — visible in the sidebar header /// and quick-glance proof that you're seeing the current build. -const String kStudioVersion = '0.63.0'; +const String kStudioVersion = '0.64.0'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); diff --git a/lib/pages/flows.dart b/lib/pages/flows.dart index f682eba..df7ea9d 100644 --- a/lib/pages/flows.dart +++ b/lib/pages/flows.dart @@ -57,6 +57,44 @@ class _FlowsPageState extends State { } } + /// Quick-fix handler — invoked when the operator clicks + /// `Install ` on an analyzer issue. Parses the + /// editor-supplied `provider/name@version` spec into the + /// Hub's install API and returns the refreshed capability + /// list so the editor can re-analyze without waiting for the + /// parent widget rebuild. + Future?> _onInstallCapability(String capability) async { + try { + // Editor passes the raw `use:` value (e.g. + // `text.classify@^1`). HubService.installModule resolves + // any version spec the hub's registry accepts. + await HubService.instance.installModule(source: capability); + final caps = await HubService.instance.allCapabilities(); + final updated = caps + .map((c) => '${c.capability}@${c.version}') + .toSet() + .toList() + ..sort(); + if (mounted) { + // Refresh the cached capability future so subsequent + // FutureBuilder rebuilds also see the new list. + setState(() => _capabilities = Future.value(updated)); + } + return updated; + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).removeCurrentSnackBar(); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Install failed: $e'), + behavior: SnackBarBehavior.floating, + ), + ); + } + return null; + } + } + @override Widget build(BuildContext context) { final locale = Localizations.localeOf(context); @@ -72,6 +110,7 @@ class _FlowsPageState extends State { locale: editorLocale, runDriver: _driver, availableCapabilities: caps, + onInstallCapability: _onInstallCapability, ); }, ); diff --git a/pubspec.yaml b/pubspec.yaml index 947942a..129fc1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: fai_studio description: "F∆I Studio — desktop GUI for the F∆I hub" publish_to: 'none' -version: 0.63.0 +version: 0.64.0 environment: sdk: ^3.11.0-200.1.beta