Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Enables extraction of component-level metadata (name and description) from Vue components for tooling like web-types.json generation.

Changes

  • Interface: Added optional name and description fields to ComponentMeta
  • Extraction logic:
    • name: Reads from component options name property (Options API)
    • description: Parses JSDoc comments on export statements using ts.getJSDocCommentsAndTags()
  • Utilities: Extracted shared AST traversal functions (getComponentNodeFromAst, getComponentOptionsNodeFromComponent)
  • Tests: Added coverage for Vue/TS components with/without name and description

Usage

const meta = checker.getComponentMeta('./MyButton.ts');

console.log(meta.name);        // 'MyButton'
console.log(meta.description); // JSDoc comment from export

Limitations

  • JSDoc descriptions only extracted for .ts/.js files (Vue SFCs not supported due to TypeScript virtual file processing)
  • Both fields return undefined when not present

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • plugins.dprint.dev
    • Triggering command: /home/REDACTED/work/language-tools/language-tools/node_modules/.pnpm/dprint@0.50.0/node_modules/dprint/dprint /home/REDACTED/work/language-tools/language-tools/node_modules/.pnpm/dprint@0.50.0/node_modules/dprint/dprint fmt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add component description and name to vue-component-meta</issue_title>
<issue_description>### What problem does this feature solve?

I am using vue-component-meta to extract meta data from my components to then generate web-typers.json so that IntelliJ will correctly offer data on hover and the autocomplete works. This works great for what is currently offered, but I would like to also get the component description that can be added by using a jsdoc string above the export default.

Currently I do that with a workaround, namely reading the file from disk, parsing and compiling it with the vue-compiler-sfc, then throwing the resulting js code into a jsdoc extraction script and it seems like such a waste to go through all that, when I see that vue-component-meta already deals with exports in a private function.

What does the proposed solution look like?

I propose to add a name and a description entry on the root of ComponentMeta to also expose the "global" meta data for the component. Name can technically be inferred from the file name, but with the option of actually setting a name in the options api it would be nice to also expose that.

{
  name: 'MyComponent',
  description: 'My awesome component description',
  type: [Getter],
  props: [Getter],
  events: [Getter],
  slots: [Getter],
  exposed: [Getter]
}
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 2, 2025 17:56
Co-authored-by: johnsoncodehk <16279759+johnsoncodehk@users.noreply.github.com>
Co-authored-by: johnsoncodehk <16279759+johnsoncodehk@users.noreply.github.com>
Copilot AI changed the title [WIP] Add component description and name to vue-component-meta Add component name and description fields to ComponentMeta Dec 2, 2025
Copilot AI requested a review from johnsoncodehk December 2, 2025 18:02
Copilot finished work on behalf of johnsoncodehk December 2, 2025 18:02
@johnsoncodehk johnsoncodehk changed the title Add component name and description fields to ComponentMeta feat(component-meta): add component name and description fields Dec 2, 2025
@johnsoncodehk johnsoncodehk marked this pull request as ready for review December 2, 2025 18:31
@johnsoncodehk johnsoncodehk merged commit a1b8b71 into master Dec 2, 2025
13 checks passed
@johnsoncodehk johnsoncodehk deleted the copilot/add-component-name-description branch December 2, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add component description and name to vue-component-meta

2 participants