vscode-extension-projectVS Code 扩展:自动收集工作区 Vue 组件的 解决问题
|
| 命令 ID | 标题 | 说明 |
|---|---|---|
extension.generatePropsHints |
collect props:Generate Vue/JS Props Hints | 立即重新扫描并生成提示文件。 |
extension.openPropsHintsSettings |
collect props:Open Props Hints Settings | 打开内置 Markdown 说明,介绍生成策略。 |
extension.openPropsHintsFile |
collect props:Open Generated Props Hints File | 打开 .vscode/component-props-hints.d.ts。 |
生成产物
.vscode/component-props-hints.d.ts:导出componentPropsHints数组,便于在编辑器或其他脚本中引用。.vscode/component-props-hints.json:悬浮提示数据源,包含component、filePath、line、props等字段。
日志输出
- 扩展运行时会将信息写入 VS Code Output 面板的
Component Props Hints通道,同时也会镜像到开发者工具控制台,便于排查问题。
component-props-hints.d.ts 示例:
export interface ComponentPropHint {
component: string;
prop: string;
type?: string;
required?: boolean;
description?: string;
defaultValue?: string;
}
export const componentPropsHints: ComponentPropHint[] = [
{ component: 'MyCard', prop: 'title', type: 'string', required: false, description: '标题文案', defaultValue: '' },
// ...
];
项目中 .gitignore 配置忽略
*.vscode/component-props-hints.*
常见问题
- 未找到
src目录:扩展不会生成任何文件,请确保工作区根目录存在src。 - 提示文件未刷新:确认
src下.vue文件事件是否被监听,或手动运行Generate Vue/JS Props Hints。 - Hover 无数据:确保
.vscode/component-props-hints.json存在且解析成功,并在 Output 面板选择Component Props Hints查看日志详情。
贡献
欢迎提交问题和拉取请求!请确保遵循项目的贡献指南。
许可证
本项目遵循 MIT 许可证。有关详细信息,请参阅 LICENSE 文件。
欢迎通过 Issue/PR 反馈问题或提交改进想法。

