mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat(ide): improve IDE installation UX and feedback (#6677)
This commit is contained in:
@@ -104,8 +104,13 @@ export class IdeClient {
|
||||
|
||||
this.setState(IDEConnectionStatus.Connecting);
|
||||
|
||||
const ideInfoFromFile = await this.getIdeInfoFromFile();
|
||||
const workspacePath =
|
||||
ideInfoFromFile.workspacePath ??
|
||||
process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'];
|
||||
|
||||
const { isValid, error } = IdeClient.validateWorkspacePath(
|
||||
process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'],
|
||||
workspacePath,
|
||||
this.currentIdeDisplayName,
|
||||
process.cwd(),
|
||||
);
|
||||
@@ -115,7 +120,7 @@ export class IdeClient {
|
||||
return;
|
||||
}
|
||||
|
||||
const portFromFile = await this.getPortFromFile();
|
||||
const portFromFile = ideInfoFromFile.port;
|
||||
if (portFromFile) {
|
||||
const connected = await this.establishConnection(portFromFile);
|
||||
if (connected) {
|
||||
@@ -311,7 +316,10 @@ export class IdeClient {
|
||||
return port;
|
||||
}
|
||||
|
||||
private async getPortFromFile(): Promise<string | undefined> {
|
||||
private async getIdeInfoFromFile(): Promise<{
|
||||
port?: string;
|
||||
workspacePath?: string;
|
||||
}> {
|
||||
try {
|
||||
const ideProcessId = await getIdeProcessId();
|
||||
const portFile = path.join(
|
||||
@@ -319,10 +327,13 @@ export class IdeClient {
|
||||
`gemini-ide-server-${ideProcessId}.json`,
|
||||
);
|
||||
const portFileContents = await fs.promises.readFile(portFile, 'utf8');
|
||||
const port = JSON.parse(portFileContents).port;
|
||||
return port.toString();
|
||||
const ideInfo = JSON.parse(portFileContents);
|
||||
return {
|
||||
port: ideInfo?.port?.toString(),
|
||||
workspacePath: ideInfo?.workspacePath,
|
||||
};
|
||||
} catch (_) {
|
||||
return undefined;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user