mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
fix: 修复 Extension Management 命令报错 (问题 6)
- 在 listAction 中添加 ExtensionManager 可用性检查 - 当 ExtensionManager 不可用时显示友好的错误提示 - 改进:避免用户遇到静默失败,提供明确的环境不支持信息
This commit is contained in:
parent
4dfaa12e16
commit
2d5088e58f
1 changed files with 22 additions and 1 deletions
|
|
@ -92,7 +92,28 @@ async function exploreAction(context: CommandContext, args: string) {
|
|||
}
|
||||
}
|
||||
|
||||
async function listAction(_context: CommandContext, _args: string) {
|
||||
async function listAction(context: CommandContext, _args: string) {
|
||||
const extensionManager = context.services.config?.getExtensionManager();
|
||||
|
||||
if (!(extensionManager instanceof ExtensionManager)) {
|
||||
debugLogger.error(
|
||||
`Cannot ${context.invocation?.name} extensions in this environment`,
|
||||
);
|
||||
|
||||
// Show user-friendly error message
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
text: t(
|
||||
'Extension management is not available in the current environment. ' +
|
||||
'This feature may not be supported in your current mode or configuration.',
|
||||
),
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'dialog' as const,
|
||||
dialog: 'extensions_manage' as const,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue