Skip to content

template props intellisense respect to jsdoc type #1337

Closed
@bingzheyuan

Description

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: win7 x64
  • Vetur version: 0.21.0
  • VS Code version: 1.35.1

Problem

image
Props intelliSense has been provided to template interpolation since #1083 , however for Object type seems not enough, is that possible to provide intelliSence type base on jsDoc @type? For the code in image, when I type . after sum, there's no intelliSence at all, I shall expect to select from v1 and v2.

Reproducible Case

Create a Vue component with following code

// Test.vue
<template>
  <div class="container">
    <p v-if="loading">loading...{{sum}}</p>
    <h1 v-if="!loading">
      <p>{{sum.v1}}</p> <!--  <--- here after sum I shall have intelliSense -->
      <p>{{sum.v2}}</p>
    </h1>
  </div>
</template>

<script>
export default {
  name: 'Test',
  props: {
    loading: {
      type: Boolean,
      required: true
    },
    /** @type {{v1: number, v2: number}} */
    sum: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      message: 'Using Parcel In A Vue.js App',
    };
  },
};
</script>

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions