vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.87k stars 403 forks source link

feat(language-service): auto insert `const props =` with `props` completion #4942

Closed KazariEX closed 3 weeks ago

KazariEX commented 4 weeks ago

from:

<script lang="ts" setup>
defineProps<{
    foo: string;
}>();
pro|
</script>

to:

<script lang="ts" setup>
const props = defineProps<{
    foo: string;
}>();
props
</script>

It also applies to defineEmits and defineSlots.

pkg-pr-new[bot] commented 4 weeks ago

Open in Stackblitz

vue-component-type-helpers

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@4942 ```

@vue/language-plugin-pug

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@4942 ```

@vue/language-core

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-core@4942 ```

@vue/language-server

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-server@4942 ```

@vue/language-service

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/language-service@4942 ```

vue-tsc

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-tsc@4942 ```

@vue/typescript-plugin

``` pnpm add https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@4942 ```

vue-component-meta

``` pnpm add https://pkg.pr.new/vuejs/language-tools/vue-component-meta@4942 ```

commit: 9ed0acf