@@ -27,10 +27,26 @@ export class IntegrationManager implements IIntegrationManager {
2727 public activate ( ) : void {
2828 // Register the manage integrations command
2929 // The command can optionally receive an integration ID to select/configure
30+ // Note: When invoked from a notebook cell status bar, VSCode passes context object first,
31+ // then the actual arguments from the command definition
3032 this . extensionContext . subscriptions . push (
31- commands . registerCommand ( Commands . ManageIntegrations , ( integrationId ?: string ) =>
32- this . showIntegrationsUI ( integrationId )
33- )
33+ commands . registerCommand ( Commands . ManageIntegrations , ( ...args : unknown [ ] ) => {
34+ logger . debug ( `IntegrationManager: Command invoked with args:` , args ) ;
35+
36+ // Find the integration ID from the arguments
37+ // It could be the first arg (if called directly) or in the args array (if called from UI)
38+ let integrationId : string | undefined ;
39+
40+ for ( const arg of args ) {
41+ if ( typeof arg === 'string' ) {
42+ integrationId = arg ;
43+ break ;
44+ }
45+ }
46+
47+ logger . debug ( `IntegrationManager: Extracted integrationId: ${ integrationId } ` ) ;
48+ return this . showIntegrationsUI ( integrationId ) ;
49+ } )
3450 ) ;
3551
3652 // Listen for active notebook changes to update context
@@ -129,6 +145,17 @@ export class IntegrationManager implements IIntegrationManager {
129145
130146 logger . debug ( `IntegrationManager: Found ${ integrations . size } integrations` ) ;
131147
148+ // If a specific integration was requested (e.g., from status bar click),
149+ // ensure it's in the map even if not detected from the project
150+ if ( selectedIntegrationId && ! integrations . has ( selectedIntegrationId ) ) {
151+ logger . debug ( `IntegrationManager: Adding requested integration ${ selectedIntegrationId } to the map` ) ;
152+ const config = await this . integrationStorage . get ( selectedIntegrationId ) ;
153+ integrations . set ( selectedIntegrationId , {
154+ config : config || null ,
155+ status : config ? IntegrationStatus . Connected : IntegrationStatus . Disconnected
156+ } ) ;
157+ }
158+
132159 if ( integrations . size === 0 ) {
133160 void window . showInformationMessage ( `No integrations found in this project.` ) ;
134161 return ;
0 commit comments