IDE integration Gemini command multi-folder support + bump version (#6265)
Co-authored-by: matt korwel <matt.korwel@gmail.com>
This commit is contained in:
parent
cf7e6ff52d
commit
db347eeee8
|
@ -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",
|
||||
|
|
|
@ -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.`,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue