You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code扩展开发:命令面板未显示hello world命令求排查帮助

排查VS Code扩展默认hello world命令不显示问题
  • 检查package.json的激活事件与命令配置
    确认activationEvents中包含对应命令的触发事件,且contributes.commands里的命令ID和标题配置正确。示例正确配置:

    "activationEvents": [
        "onCommand:extension.helloWorld"
    ],
    "contributes": {
        "commands": [
            {
                "command": "extension.helloWorld",
                "title": "Hello World"
            }
        ]
    }
    
  • 查看调试窗口的扩展加载日志
    按下F5启动调试窗口后,打开输出面板(Ctrl+Shift+U),切换到"Extension Host"频道,检查是否有扩展加载失败的报错信息,根据提示修复问题(如语法错误、依赖缺失等)。

  • 校验命令ID一致性
    确保代码中vscode.commands.registerCommand的第一个参数,与package.json中contributes.commands[0].command的命令ID完全一致,大小写、字符都不能错。

  • 清理缓存后重试
    关闭所有VS Code窗口,删除对应系统的缓存目录:

    • Windows:%APPDATA%\Code\CachedData
    • macOS:~/Library/Application Support/Code/CachedData
    • Linux:~/.config/Code/CachedData
      重新启动调试会话,查看命令是否显示。

内容的提问来源于stack exchange,提问作者Harsh Prakash Agarwal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 19:30:52