mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
# 🚀 Sync Gemini CLI v0.2.1 - Major Feature Update (#483)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
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';
|
||||
@@ -20,11 +21,13 @@ let log: (message: string) => void = () => {};
|
||||
|
||||
function updateWorkspacePath(context: vscode.ExtensionContext) {
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
if (workspaceFolders && workspaceFolders.length === 1) {
|
||||
const workspaceFolder = workspaceFolders[0];
|
||||
if (workspaceFolders && workspaceFolders.length > 0) {
|
||||
const workspacePaths = workspaceFolders
|
||||
.map((folder) => folder.uri.fsPath)
|
||||
.join(path.delimiter);
|
||||
context.environmentVariableCollection.replace(
|
||||
IDE_WORKSPACE_PATH_ENV_VAR,
|
||||
workspaceFolder.uri.fsPath,
|
||||
workspacePaths,
|
||||
);
|
||||
} else {
|
||||
context.environmentVariableCollection.replace(
|
||||
@@ -77,21 +80,9 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
if (!context.globalState.get(INFO_MESSAGE_SHOWN_KEY)) {
|
||||
void vscode.window
|
||||
.showInformationMessage(
|
||||
'Qwen Code Companion extension successfully installed. Please restart your terminal to enable full IDE integration.',
|
||||
'Run Qwen Code',
|
||||
)
|
||||
.then(
|
||||
(selection) => {
|
||||
if (selection === 'Run Qwen Code') {
|
||||
void vscode.commands.executeCommand('qwen-code.runQwenCode');
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
log(`Failed to show information message: ${String(err)}`);
|
||||
},
|
||||
);
|
||||
void vscode.window.showInformationMessage(
|
||||
'Qwen Code Companion extension successfully installed.',
|
||||
);
|
||||
context.globalState.update(INFO_MESSAGE_SHOWN_KEY, true);
|
||||
}
|
||||
|
||||
@@ -99,11 +90,33 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
vscode.workspace.onDidChangeWorkspaceFolders(() => {
|
||||
updateWorkspacePath(context);
|
||||
}),
|
||||
vscode.commands.registerCommand('qwen-code.runQwenCode', () => {
|
||||
const qwenCmd = 'qwen';
|
||||
const terminal = vscode.window.createTerminal(`Qwen Code`);
|
||||
terminal.show();
|
||||
terminal.sendText(qwenCmd);
|
||||
vscode.commands.registerCommand('qwen-code.runQwenCode', async () => {
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders;
|
||||
if (!workspaceFolders || workspaceFolders.length === 0) {
|
||||
vscode.window.showInformationMessage(
|
||||
'No folder open. Please open a folder to run Qwen Code.',
|
||||
);
|
||||
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 Qwen Code in',
|
||||
});
|
||||
}
|
||||
|
||||
if (selectedFolder) {
|
||||
const qwenCmd = 'qwen';
|
||||
const terminal = vscode.window.createTerminal({
|
||||
name: `Qwen Code (${selectedFolder.name})`,
|
||||
cwd: selectedFolder.uri.fsPath,
|
||||
});
|
||||
terminal.show();
|
||||
terminal.sendText(qwenCmd);
|
||||
}
|
||||
}),
|
||||
vscode.commands.registerCommand('qwen-code.showNotices', async () => {
|
||||
const noticePath = vscode.Uri.joinPath(
|
||||
|
||||
Reference in New Issue
Block a user