mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
feat(ide ext): Write workspace path to port file (#6659)
This commit is contained in:
@@ -5,13 +5,11 @@
|
||||
*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { IDEServer } from './ide-server.js';
|
||||
import { DiffContentProvider, DiffManager } from './diff-manager.js';
|
||||
import { createLogger } from './utils/logger.js';
|
||||
|
||||
const INFO_MESSAGE_SHOWN_KEY = 'geminiCliInfoMessageShown';
|
||||
const IDE_WORKSPACE_PATH_ENV_VAR = 'GEMINI_CLI_IDE_WORKSPACE_PATH';
|
||||
export const DIFF_SCHEME = 'gemini-diff';
|
||||
|
||||
let ideServer: IDEServer;
|
||||
@@ -19,31 +17,11 @@ let logger: vscode.OutputChannel;
|
||||
|
||||
let log: (message: string) => void = () => {};
|
||||
|
||||
function updateWorkspacePath(context: vscode.ExtensionContext) {
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
if (workspaceFolders && workspaceFolders.length > 0) {
|
||||
const workspacePaths = workspaceFolders
|
||||
.map((folder) => folder.uri.fsPath)
|
||||
.join(path.delimiter);
|
||||
context.environmentVariableCollection.replace(
|
||||
IDE_WORKSPACE_PATH_ENV_VAR,
|
||||
workspacePaths,
|
||||
);
|
||||
} else {
|
||||
context.environmentVariableCollection.replace(
|
||||
IDE_WORKSPACE_PATH_ENV_VAR,
|
||||
'',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
logger = vscode.window.createOutputChannel('Gemini CLI IDE Companion');
|
||||
log = createLogger(context, logger);
|
||||
log('Extension activated');
|
||||
|
||||
updateWorkspacePath(context);
|
||||
|
||||
const diffContentProvider = new DiffContentProvider();
|
||||
const diffManager = new DiffManager(log, diffContentProvider);
|
||||
|
||||
@@ -94,7 +72,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.workspace.onDidChangeWorkspaceFolders(() => {
|
||||
updateWorkspacePath(context);
|
||||
ideServer.updateWorkspacePath();
|
||||
}),
|
||||
vscode.commands.registerCommand('gemini-cli.runGeminiCLI', async () => {
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
|
||||
Reference in New Issue
Block a user