diff --git a/src/extension.ts b/src/extension.ts index e6c5f74..ec7ae25 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -157,12 +157,8 @@ export function activate(context: vscode.ExtensionContext) { try { const session = await vscode.authentication.getSession("iccoder", [], { createIfNone: false }); if (session) { - // 通过创建新会话并清除偏好来实现登出 - await vscode.authentication.getSession("iccoder", [], { - clearSessionPreference: true, - forceNewSession: true - }); - vscode.window.showInformationMessage("已退出登录"); + // 调用 authProvider 的 removeSession 方法 + await authProvider.removeSession(session.id); } else { vscode.window.showInformationMessage("当前未登录"); } diff --git a/src/panels/ICHelperPanel.ts b/src/panels/ICHelperPanel.ts index a31e328..03285f8 100644 --- a/src/panels/ICHelperPanel.ts +++ b/src/panels/ICHelperPanel.ts @@ -340,6 +340,10 @@ export async function showICHelperPanel( }); } break; + case "logout": + // 退出登录 + vscode.commands.executeCommand("ic-coder.logout"); + break; // 处理计划操作(只做模式切换,响应已通过 submitAnswer 发送) case "planAction": if (message.action === "confirm") { diff --git a/src/views/userInfoComponent.ts b/src/views/userInfoComponent.ts index 95bb043..1943b52 100644 --- a/src/views/userInfoComponent.ts +++ b/src/views/userInfoComponent.ts @@ -30,6 +30,9 @@ export function getUserInfoComponentContent(): string { 剩余 Credits - +