VSCode Vue3 + Typescript intellisense with Composition API

Viewed 586

I'm starting a new project with Vue3 and Typescript. I'm new to Vue, but I've been using Typescript for the last couple of years. I rely heavily on intellisense for autocomplete and refactoring.

I'm currently trying to learn Composition API, and already can't seem to get intellisense to work with properties declared inside the setup(), as you can see in the attached images.

Autocomplete not working in the returned object

Autocomplete not working in the template

I have Vetur and Typescript installed. About the first picture, I'm guessing VSCode expects the text I'm writing inside the brackets to be an object property/index?

The template one seems to occasionally work when I also enable VueDX.

Is there a way to get intellisense to work with this? Like I said, I rely heavily on intellisense for refactoring, changing variable names and so on.

Edit: code

<template>
    <div>
        <p> {{ text }} </p>
    </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
    setup() {
        const text = "text";

        return { text };
    },
})
</script>

Thanks

0 Answers
Related