[ide-mode] Update handling of workspace paths (#6014)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
parent
0e98641b51
commit
c0f5f6a5f6
|
@ -134,7 +134,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||||
);
|
);
|
||||||
if (config?.getIdeMode() && config?.getIdeModeFeature()) {
|
if (config?.getIdeMode() && config?.getIdeModeFeature()) {
|
||||||
options.push({
|
options.push({
|
||||||
label: 'No',
|
label: 'No (esc)',
|
||||||
value: ToolConfirmationOutcome.Cancel,
|
value: ToolConfirmationOutcome.Cancel,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
|
import * as path from 'node:path';
|
||||||
import {
|
import {
|
||||||
detectIde,
|
detectIde,
|
||||||
DetectedIde,
|
DetectedIde,
|
||||||
|
@ -249,7 +250,11 @@ export class IdeClient {
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getRealPath(ideWorkspacePath) !== getRealPath(process.cwd())) {
|
|
||||||
|
const idePath = getRealPath(ideWorkspacePath).toLocaleLowerCase();
|
||||||
|
const cwd = getRealPath(process.cwd()).toLocaleLowerCase();
|
||||||
|
const rel = path.relative(idePath, cwd);
|
||||||
|
if (rel.startsWith('..') || path.isAbsolute(rel)) {
|
||||||
this.setState(
|
this.setState(
|
||||||
IDEConnectionStatus.Disconnected,
|
IDEConnectionStatus.Disconnected,
|
||||||
`Directory mismatch. Gemini CLI is running in a different location than the open workspace in ${this.currentIdeDisplayName}. Please run the CLI from the same directory as your project's root folder.`,
|
`Directory mismatch. Gemini CLI is running in a different location than the open workspace in ${this.currentIdeDisplayName}. Please run the CLI from the same directory as your project's root folder.`,
|
||||||
|
|
Loading…
Reference in New Issue