fix:解决登录过期点击重新登录失败的bug

This commit is contained in:
Roe-xin
2026-03-03 14:19:00 +08:00
parent 8f305033f7
commit 3458f6fe23
5 changed files with 41 additions and 19 deletions

View File

@ -88,6 +88,7 @@ CO03l8nmFBBTNPDg7lN9a9fYwDdgsRIDVDwTrx6Esggi6HnzmrMTJQQJ99BLACAAAAAAAAAAAAAGAZDO
5. 点击 **Create** 完成创建 5. 点击 **Create** 完成创建
**注意事项:** **注意事项:**
- Publisher ID 一旦创建无法修改 - Publisher ID 一旦创建无法修改
- Publisher ID 必须全局唯一 - Publisher ID 必须全局唯一
- 建议使用有意义且专业的 ID - 建议使用有意义且专业的 ID
@ -126,6 +127,7 @@ CO03l8nmFBBTNPDg7lN9a9fYwDdgsRIDVDwTrx6Esggi6HnzmrMTJQQJ99BLACAAAAAAAAAAAAAGAZDO
## [0.0.2] - 2025-12-29 ## [0.0.2] - 2025-12-29
### 新增 ### 新增
- 添加发送和暂停按钮功能 - 添加发送和暂停按钮功能
- 添加一键优化按钮组件 - 添加一键优化按钮组件
- 添加 Plan 开关组件 - 添加 Plan 开关组件
@ -133,11 +135,13 @@ CO03l8nmFBBTNPDg7lN9a9fYwDdgsRIDVDwTrx6Esggi6HnzmrMTJQQJ99BLACAAAAAAAAAAAAAGAZDO
- 添加上下文压缩功能 - 添加上下文压缩功能
### 改进 ### 改进
- 优化用户界面交互体验 - 优化用户界面交互体验
## [0.0.1] - 2025-12-XX ## [0.0.1] - 2025-12-XX
### 新增 ### 新增
- 初始版本发布 - 初始版本发布
- Verilog 代码智能生成 - Verilog 代码智能生成
- 集成 iverilog 仿真工具 - 集成 iverilog 仿真工具
@ -161,6 +165,7 @@ in the Software without restriction...
### 4. 优化 README.md ### 4. 优化 README.md
确保 README 包含: 确保 README 包含:
- 清晰的功能介绍 - 清晰的功能介绍
- 使用截图或 GIF 演示 - 使用截图或 GIF 演示
- 详细的使用说明 - 详细的使用说明
@ -219,6 +224,7 @@ pnpm vsce publish
**步骤:** **步骤:**
1. 本地打包插件: 1. 本地打包插件:
```bash ```bash
pnpm run package pnpm run package
pnpm vsce package[pnpm vsce package --no-dependencies] pnpm vsce package[pnpm vsce package --no-dependencies]
@ -257,7 +263,7 @@ pnpm vsce publish major
```bash ```bash
# 发布指定版本 # 发布指定版本
pnpm vsce publish 0.0.3 npx vsce publish --packagePath iccoder-1.0.7.vsix
``` ```
### 更新流程建议 ### 更新流程建议
@ -268,8 +274,6 @@ pnpm vsce publish 0.0.3
4. 执行发布命令 4. 执行发布命令
5. 验证市场上的插件是否正常 5. 验证市场上的插件是否正常
## 更新流程 ## 更新流程
1. 修改版本号 1. 修改版本号
@ -302,10 +306,7 @@ pnpm vsce publish 0.0.3
pnpm vsce package --no-dependencies pnpm vsce package --no-dependencies
``` ```
3. 手动上传/命令上传 3. 手动上传/命令上传
- https://marketplace.visualstudio.com/ 在这个里面手动上传 更新就选择update - https://marketplace.visualstudio.com/ 在这个里面手动上传 更新就选择update
- 命令上传vsce publish - 命令上传vsce publish
@ -318,6 +319,7 @@ pnpm vsce publish 0.0.3
**原因:** PAT Token 无效或过期 **原因:** PAT Token 无效或过期
**解决方案:** **解决方案:**
- 重新生成 PAT Token - 重新生成 PAT Token
- 重新登录:`pnpm vsce login ic-coder-team` - 重新登录:`pnpm vsce login ic-coder-team`
@ -326,6 +328,7 @@ pnpm vsce publish 0.0.3
**原因:** Publisher ID 不存在或不匹配 **原因:** Publisher ID 不存在或不匹配
**解决方案:** **解决方案:**
- 检查 `package.json` 中的 `publisher` 字段 - 检查 `package.json` 中的 `publisher` 字段
- 确认已在市场创建对应的 Publisher - 确认已在市场创建对应的 Publisher
@ -334,17 +337,20 @@ pnpm vsce publish 0.0.3
**原因:** 必需文件缺失 **原因:** 必需文件缺失
**解决方案:** **解决方案:**
- 确保 `dist/` 目录存在且包含编译后的代码 - 确保 `dist/` 目录存在且包含编译后的代码
- 运行 `pnpm run package` 重新构建 - 运行 `pnpm run package` 重新构建
### 4. 插件审核被拒 ### 4. 插件审核被拒
**常见原因:** **常见原因:**
- 插件名称或描述违反市场规则 - 插件名称或描述违反市场规则
- 图标不符合要求(建议 128x128 PNG - 图标不符合要求(建议 128x128 PNG
- README 内容不完整 - README 内容不完整
**解决方案:** **解决方案:**
- 查看审核反馈邮件 - 查看审核反馈邮件
- 修改相关内容后重新发布 - 修改相关内容后重新发布
@ -366,6 +372,7 @@ code --install-extension ic-coder-plugin-0.0.2.vsix
``` ```
或者在 VS Code 中: 或者在 VS Code 中:
1. 打开扩展面板 1. 打开扩展面板
2. 点击 `...` 菜单 2. 点击 `...` 菜单
3. 选择 **Install from VSIX...** 3. 选择 **Install from VSIX...**

View File

@ -159,8 +159,9 @@ export async function activate(context: vscode.ExtensionContext) {
// 注册命令:用户登录 // 注册命令:用户登录
const loginCommand = vscode.commands.registerCommand( const loginCommand = vscode.commands.registerCommand(
"ic-coder.login", "ic-coder.login",
async () => { async (options?: { forceReauth?: boolean }) => {
try { try {
const forceReauth = options?.forceReauth === true;
const session = await vscode.authentication.getSession("iccoder", [], { const session = await vscode.authentication.getSession("iccoder", [], {
createIfNone: false, createIfNone: false,
}); });
@ -169,7 +170,7 @@ export async function activate(context: vscode.ExtensionContext) {
: null; : null;
// 会话仍有效时,直接打开聊天面板 // 会话仍有效时,直接打开聊天面板
if (session && expired !== true) { if (session && expired === false && !forceReauth) {
vscode.commands.executeCommand("ic-coder.openChat"); vscode.commands.executeCommand("ic-coder.openChat");
return; return;
} }

View File

@ -91,7 +91,9 @@ export async function showICHelperPanel(
"立即登录", "立即登录",
); );
if (action === "立即登录") { if (action === "立即登录") {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
return; return;
} }
@ -106,7 +108,9 @@ export async function showICHelperPanel(
.showWarningMessage("请先登录后再使用 IC Coder", "立即登录") .showWarningMessage("请先登录后再使用 IC Coder", "立即登录")
.then((selection) => { .then((selection) => {
if (selection === "立即登录") { if (selection === "立即登录") {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
}); });
return; return;
@ -116,7 +120,9 @@ export async function showICHelperPanel(
.showWarningMessage("请先登录后再使用 IC Coder", "立即登录") .showWarningMessage("请先登录后再使用 IC Coder", "立即登录")
.then((selection) => { .then((selection) => {
if (selection === "立即登录") { if (selection === "立即登录") {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
}); });
return; return;

View File

@ -449,7 +449,9 @@ export class DialogSession {
.showErrorMessage("登录已过期,请重新登录", "重新登录") .showErrorMessage("登录已过期,请重新登录", "重新登录")
.then((selection) => { .then((selection) => {
if (selection === "重新登录") { if (selection === "重新登录") {
vscode.commands.executeCommand("iccoder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
}); });
throw new Error("登录已过期,请重新登录"); throw new Error("登录已过期,请重新登录");
@ -894,7 +896,9 @@ export class DialogSession {
.showErrorMessage("登录状态已过期,请重新登录", "重新登录") .showErrorMessage("登录状态已过期,请重新登录", "重新登录")
.then((selection) => { .then((selection) => {
if (selection === "重新登录") { if (selection === "重新登录") {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
}); });
// 登录过期错误已处理,不再传递给外部 // 登录过期错误已处理,不再传递给外部

View File

@ -92,7 +92,9 @@ export async function handleUserMessage(
); );
if (action === '立即登录') { if (action === '立即登录') {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
// 恢复输入状态 // 恢复输入状态
@ -126,7 +128,9 @@ export async function handleUserMessage(
); );
if (action === '立即登录') { if (action === '立即登录') {
vscode.commands.executeCommand("ic-coder.login"); vscode.commands.executeCommand("ic-coder.login", {
forceReauth: true,
});
} }
// 恢复输入状态 // 恢复输入状态