mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
refactor(vscode-ide-companion/cli): consolidate CLI detection and version management
- Replace separate CliDetector, CliVersionChecker, and CliVersionManager classes with unified CliManager - Remove redundant code and simplify CLI detection logic - Maintain all existing functionality while improving code organization - Update imports in dependent files to use CliManager This change reduces complexity by consolidating CLI-related functionality into a single manager class.
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
import * as vscode from 'vscode';
|
||||
import type { AuthenticateUpdateNotification } from '../types/acpTypes.js';
|
||||
|
||||
// Store reference to the authentication notification to allow auto-closing
|
||||
let authNotificationDisposable: { dispose: () => void } | null = null;
|
||||
// Store reference to the current notification
|
||||
let currentNotification: Thenable<string | undefined> | null = null;
|
||||
|
||||
/**
|
||||
* Handle authentication update notifications by showing a VS Code notification
|
||||
* with the authentication URI and a copy button.
|
||||
* with the authentication URI and action buttons.
|
||||
*
|
||||
* @param data - Authentication update notification data containing the auth URI
|
||||
*/
|
||||
@@ -21,30 +21,21 @@ export function handleAuthenticateUpdate(
|
||||
): void {
|
||||
const authUri = data._meta.authUri;
|
||||
|
||||
// Dismiss any existing authentication notification
|
||||
if (authNotificationDisposable) {
|
||||
authNotificationDisposable.dispose();
|
||||
authNotificationDisposable = null;
|
||||
}
|
||||
|
||||
// Show an information message with the auth URI and copy button
|
||||
const notificationPromise = vscode.window.showInformationMessage(
|
||||
`Qwen Code needs authentication. Click the button below to open the authentication page or copy the link to your browser.`,
|
||||
// Store reference to the current notification
|
||||
currentNotification = vscode.window.showInformationMessage(
|
||||
`Qwen Code needs authentication. Click an action below:`,
|
||||
'Open in Browser',
|
||||
'Copy Link',
|
||||
'Dismiss',
|
||||
);
|
||||
|
||||
// Create a simple disposable object
|
||||
authNotificationDisposable = {
|
||||
dispose: () => {
|
||||
// We can't actually cancel the promise, but we can clear our reference
|
||||
},
|
||||
};
|
||||
|
||||
notificationPromise.then((selection) => {
|
||||
currentNotification.then((selection) => {
|
||||
if (selection === 'Open in Browser') {
|
||||
// Open the authentication URI in the default browser
|
||||
vscode.env.openExternal(vscode.Uri.parse(authUri));
|
||||
vscode.window.showInformationMessage(
|
||||
'Opening authentication page in your browser...',
|
||||
);
|
||||
} else if (selection === 'Copy Link') {
|
||||
// Copy the authentication URI to clipboard
|
||||
vscode.env.clipboard.writeText(authUri);
|
||||
@@ -54,6 +45,6 @@ export function handleAuthenticateUpdate(
|
||||
}
|
||||
|
||||
// Clear the notification reference after user interaction
|
||||
authNotificationDisposable = null;
|
||||
currentNotification = null;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user