summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreya Keshive <[email protected]>2025-08-15 00:07:06 +0000
committerGitHub <[email protected]>2025-08-15 00:07:06 +0000
commitdb347eeee88a7610372915c94b1ab5616aa9ce3d (patch)
treefbbdcbe7f6eb6740284bace282edb1d44ba12b91
parentcf7e6ff52d6b947a1b59779ddb39d265beebafab (diff)
IDE integration Gemini command multi-folder support + bump version (#6265)
Co-authored-by: matt korwel <[email protected]>
-rw-r--r--package-lock.json2
-rw-r--r--packages/core/src/ide/ide-client.ts4
-rw-r--r--packages/core/src/ide/ide-installer.ts3
-rw-r--r--packages/vscode-ide-companion/package.json2
-rw-r--r--packages/vscode-ide-companion/src/extension.test.ts12
-rw-r--r--packages/vscode-ide-companion/src/extension.ts50
6 files changed, 42 insertions, 31 deletions
diff --git a/package-lock.json b/package-lock.json
index efd3b955..3f6a3706 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12721,7 +12721,7 @@
},
"packages/vscode-ide-companion": {
"name": "gemini-cli-vscode-ide-companion",
- "version": "0.1.19",
+ "version": "0.1.21",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",
diff --git a/packages/core/src/ide/ide-client.ts b/packages/core/src/ide/ide-client.ts
index 810e82e0..5ec0bb5c 100644
--- a/packages/core/src/ide/ide-client.ts
+++ b/packages/core/src/ide/ide-client.ts
@@ -123,7 +123,7 @@ export class IdeClient {
this.setState(
IDEConnectionStatus.Disconnected,
- `Failed to connect to IDE companion extension for ${this.currentIdeDisplayName}. Please ensure the extension is running and try restarting your terminal. To install the extension, run /ide install.`,
+ `Failed to connect to IDE companion extension for ${this.currentIdeDisplayName}. Please ensure the extension is running. To install the extension, run /ide install.`,
true,
);
}
@@ -261,7 +261,7 @@ export class IdeClient {
if (ideWorkspacePath === undefined) {
return {
isValid: false,
- error: `Failed to connect to IDE companion extension for ${currentIdeDisplayName}. Please ensure the extension is running and try refreshing your terminal. To install the extension, run /ide install.`,
+ error: `Failed to connect to IDE companion extension for ${currentIdeDisplayName}. Please ensure the extension is running. To install the extension, run /ide install.`,
};
}
diff --git a/packages/core/src/ide/ide-installer.ts b/packages/core/src/ide/ide-installer.ts
index 7b9ead77..dcfe9bee 100644
--- a/packages/core/src/ide/ide-installer.ts
+++ b/packages/core/src/ide/ide-installer.ts
@@ -106,8 +106,7 @@ class VsCodeInstaller implements IdeInstaller {
child_process.execSync(command, { stdio: 'pipe' });
return {
success: true,
- message:
- 'VS Code companion extension was installed successfully. Please restart your terminal to complete the setup.',
+ message: 'VS Code companion extension was installed successfully.',
};
} catch (_error) {
return {
diff --git a/packages/vscode-ide-companion/package.json b/packages/vscode-ide-companion/package.json
index 187da3e8..de2e4834 100644
--- a/packages/vscode-ide-companion/package.json
+++ b/packages/vscode-ide-companion/package.json
@@ -2,7 +2,7 @@
"name": "gemini-cli-vscode-ide-companion",
"displayName": "Gemini CLI Companion",
"description": "Enable Gemini CLI with direct access to your IDE workspace.",
- "version": "0.1.19",
+ "version": "0.1.21",
"publisher": "google",
"icon": "assets/icon.png",
"repository": {
diff --git a/packages/vscode-ide-companion/src/extension.test.ts b/packages/vscode-ide-companion/src/extension.test.ts
index 2b3db5ac..5a738c2a 100644
--- a/packages/vscode-ide-companion/src/extension.test.ts
+++ b/packages/vscode-ide-companion/src/extension.test.ts
@@ -25,6 +25,7 @@ vi.mock('vscode', () => ({
close: vi.fn(),
},
showTextDocument: vi.fn(),
+ showWorkspaceFolderPick: vi.fn(),
},
workspace: {
workspaceFolders: [],
@@ -80,8 +81,7 @@ describe('activate', () => {
vi.mocked(context.globalState.get).mockReturnValue(undefined);
await activate(context);
expect(showInformationMessageMock).toHaveBeenCalledWith(
- 'Gemini CLI Companion extension successfully installed. Please restart your terminal to enable full IDE integration.',
- 'Re-launch Gemini CLI',
+ 'Gemini CLI Companion extension successfully installed.',
);
});
@@ -99,8 +99,10 @@ describe('activate', () => {
await activate(context);
expect(showInformationMessageMock).toHaveBeenCalled();
await new Promise(process.nextTick); // Wait for the promise to resolve
- expect(vscode.commands.executeCommand).toHaveBeenCalledWith(
- 'gemini-cli.runGeminiCLI',
- );
+ const commandCallback = vi
+ .mocked(vscode.commands.registerCommand)
+ .mock.calls.find((call) => call[0] === 'gemini-cli.runGeminiCLI')?.[1];
+
+ expect(commandCallback).toBeDefined();
});
});
diff --git a/packages/vscode-ide-companion/src/extension.ts b/packages/vscode-ide-companion/src/extension.ts
index 10aa41f8..a491ac41 100644
--- a/packages/vscode-ide-companion/src/extension.ts
+++ b/packages/vscode-ide-companion/src/extension.ts
@@ -85,21 +85,9 @@ export async function activate(context: vscode.ExtensionContext) {
}
if (!context.globalState.get(INFO_MESSAGE_SHOWN_KEY)) {
- void vscode.window
- .showInformationMessage(
- 'Gemini CLI Companion extension successfully installed. Please restart your terminal to enable full IDE integration.',
- 'Re-launch Gemini CLI',
- )
- .then(
- (selection) => {
- if (selection === 'Re-launch Gemini CLI') {
- void vscode.commands.executeCommand('gemini-cli.runGeminiCLI');
- }
- },
- (err) => {
- log(`Failed to show information message: ${String(err)}`);
- },
- );
+ void vscode.window.showInformationMessage(
+ 'Gemini CLI Companion extension successfully installed.',
+ );
context.globalState.update(INFO_MESSAGE_SHOWN_KEY, true);
}
@@ -107,11 +95,33 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.workspace.onDidChangeWorkspaceFolders(() => {
updateWorkspacePath(context);
}),
- vscode.commands.registerCommand('gemini-cli.runGeminiCLI', () => {
- const geminiCmd = 'gemini';
- const terminal = vscode.window.createTerminal(`Gemini CLI`);
- terminal.show();
- terminal.sendText(geminiCmd);
+ vscode.commands.registerCommand('gemini-cli.runGeminiCLI', async () => {
+ const workspaceFolders = vscode.workspace.workspaceFolders;
+ if (!workspaceFolders || workspaceFolders.length === 0) {
+ vscode.window.showInformationMessage(
+ 'No folder open. Please open a folder to run Gemini CLI.',
+ );
+ return;
+ }
+
+ let selectedFolder: vscode.WorkspaceFolder | undefined;
+ if (workspaceFolders.length === 1) {
+ selectedFolder = workspaceFolders[0];
+ } else {
+ selectedFolder = await vscode.window.showWorkspaceFolderPick({
+ placeHolder: 'Select a folder to run Gemini CLI in',
+ });
+ }
+
+ if (selectedFolder) {
+ const geminiCmd = 'gemini';
+ const terminal = vscode.window.createTerminal({
+ name: `Gemini CLI (${selectedFolder.name})`,
+ cwd: selectedFolder.uri.fsPath,
+ });
+ terminal.show();
+ terminal.sendText(geminiCmd);
+ }
}),
vscode.commands.registerCommand('gemini-cli.showNotices', async () => {
const noticePath = vscode.Uri.joinPath(