diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index 7921b2039..38dad449c 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -925,7 +925,12 @@ export const AppContainer = (props: AppContainerProps) => { const handleIdePromptComplete = useCallback( (result: IdeIntegrationNudgeResult) => { if (result.userSelection === 'yes') { - handleSlashCommand('/ide install'); + // Check whether the extension has been pre-installed + if (result.isExtensionPreInstalled) { + handleSlashCommand('/ide enable'); + } else { + handleSlashCommand('/ide install'); + } settings.setValue(SettingScope.User, 'ide.hasSeenNudge', true); } else if (result.userSelection === 'dismiss') { settings.setValue(SettingScope.User, 'ide.hasSeenNudge', true); diff --git a/packages/cli/src/ui/IdeIntegrationNudge.tsx b/packages/cli/src/ui/IdeIntegrationNudge.tsx index 8ab350064..9cd6d5311 100644 --- a/packages/cli/src/ui/IdeIntegrationNudge.tsx +++ b/packages/cli/src/ui/IdeIntegrationNudge.tsx @@ -38,6 +38,7 @@ export function IdeIntegrationNudge({ ); const { displayName: ideName } = ide; + const isInSandbox = !!process.env['SANDBOX']; // Assume extension is already installed if the env variables are set. const isExtensionPreInstalled = !!process.env['QWEN_CODE_IDE_SERVER_PORT'] && @@ -70,13 +71,15 @@ export function IdeIntegrationNudge({ }, ]; - const installText = isExtensionPreInstalled - ? `If you select Yes, the CLI will have access to your open files and display diffs directly in ${ - ideName ?? 'your editor' - }.` - : `If you select Yes, we'll install an extension that allows the CLI to access your open files and display diffs directly in ${ - ideName ?? 'your editor' - }.`; + const installText = isInSandbox + ? `Note: In sandbox environments, IDE integration requires manual setup on the host system. If you select Yes, you'll receive instructions on how to set this up.` + : isExtensionPreInstalled + ? `If you select Yes, the CLI will connect to your ${ + ideName ?? 'editor' + } and have access to your open files and display diffs directly.` + : `If you select Yes, we'll install an extension that allows the CLI to access your open files and display diffs directly in ${ + ideName ?? 'your editor' + }.`; return ( => { kind: CommandKind.BUILT_IN, action: async (context) => { const installer = getIdeInstaller(currentIDE); + const isSandBox = !!process.env['SANDBOX']; + if (isSandBox) { + context.ui.addItem( + { + type: 'info', + text: `IDE integration needs to be installed on the host. If you have already installed it, you can directly connect the ide`, + }, + Date.now(), + ); + return; + } if (!installer) { + const ideName = ideClient.getDetectedIdeDisplayName(); context.ui.addItem( { type: 'error', - text: `No installer is available for ${ideClient.getDetectedIdeDisplayName()}. Please install the '${QWEN_CODE_COMPANION_EXTENSION_NAME}' extension manually from the marketplace.`, + text: `Automatic installation is not supported for ${ideName}. Please install the '${QWEN_CODE_COMPANION_EXTENSION_NAME}' extension manually from the marketplace.`, }, Date.now(), );