Skip to content

JsDoc Unable to document v-model #13179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pwang2 opened this issue Apr 9, 2025 · 2 comments
Closed

JsDoc Unable to document v-model #13179

pwang2 opened this issue Apr 9, 2025 · 2 comments
Labels
language-tools related to vue language-tools scope: types

Comments

@pwang2
Copy link

pwang2 commented Apr 9, 2025

Vue version

3.5

Link to minimal reproduction

SFC Playground

Steps to reproduce

see SFC playground

What is expected?

defineModel can show documentation when lsp hover.

What is actually happening?

<template>
  <!-- using defineModel, nothing shown for v-model, mood props is fine -->
  <Comp v-model="msg" mood="happy" />

  <!-- using defineModel,  only type shown for :model-value, mood props is fine -->
  <Comp :model-value="msg" mood="happy" />

  <!-- using defineProps + defineEmits.  using v-model syntax sugar, no docs for v-model-->
  <Comp2 v-model="msg" />

  <!--using defineProps + defineEmits.  using non syntax sugar, model-value documents is fine-->
  <Comp2 :model-value="msg" @update:model-value="void"/>
</template>
@jh-leong jh-leong added scope: types language-tools related to vue language-tools labels Apr 9, 2025
@KazariEX
Copy link
Member

KazariEX commented Apr 9, 2025

This has been implemented by vuejs/language-tools#5211.

For the v-model without argument, you can only trigger semantic features on both ends of the v-model currently.

@pwang2
Copy link
Author

pwang2 commented Apr 9, 2025

Thanks for the quick rely. Yes, you are right. Newer language tools version supports it. There might be a usability issue limited by the v-model interface , I have to focus on the equal sign after v-model in Neovim and Vscode. I think because v-model has its own description.

Also, if we build it as library. the type definition will not include the documentation for defineModel from d.ts file, after build as library with emited type. go to definition on v-model:model-value or v-model(equal sign) went to a type line as below. But everything works as expected with defineProps.

Can you help reopen if you think this is something it should be fixed?

Image

Here is what go to definition from my v-model line take me to my SFC.vue.d.ts after build.

Image

@pwang2 pwang2 closed this as completed Apr 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
language-tools related to vue language-tools scope: types
Projects
None yet
Development

No branches or pull requests

3 participants