Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Vue Composition API Typescript Snippets (570+)New to Visual Studio Code? Get it now.
Vue Composition API Typescript Snippets (570+)

Vue Composition API Typescript Snippets (570+)

ozJSey

|
153 installs
| (1) | Free
570+ fully-typed Vue 3, VueUse, Nuxt, Pinia & Vue Router snippets with intelligent auto-import and sorting. 100% TypeScript and Composition API.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Modern Vue Snippets

579+ fully-typed Vue 3 snippets with auto-import management for the Composition API + TypeScript era.

Covers Vue 3 core, VueUse, Nuxt, Pinia, and Vue Router. Every snippet ships with exact type definitions, sensible defaults, and educational descriptions.

How It Works

  1. Type a prefix (vc, vu, vn, vr) in a .vue, .ts, or .js file
  2. Pick a snippet from the autocomplete list
  3. The extension automatically moves the import to the top of your file — merging with existing imports from the same source, or adding after the last import / below <script setup> / at the beginning of the file

Nuxt users: set includeImports to false to strip imports entirely (Nuxt auto-imports them).

Snippet Collections

Prefix Library Count Example
vc Vue 3 Core 172 vcRef, vcComputed, vcWatch, vcDefineProps
vc DOM Components 124 vcTransition, vcTeleport, vcSuspense
vu VueUse 193 vuUseMouse, vuUseLocalStorage, vuUseFetch
vn Nuxt 78 vnAsyncData, vnFetch, vnUseHead, vnUseSeoMeta
vr Vue Router 12 vrUseRoute, vrUseRouter, vrRouterLink

Configuration

{
  "vueCompositionTsSnippets.autoSortImports": true,
  "vueCompositionTsSnippets.includeImports": true
}
  • autoSortImports — enable/disable automatic import management (default: true)
  • includeImports — set to false for Nuxt projects that use auto-imports (default: true)

Import Handling

When you insert a snippet that contains an import statement, the extension:

  1. Detects the snippet by checking if inserted text has import { } from statements whose names appear in the code below
  2. Strips the import lines from where the snippet was inserted
  3. Places them correctly:
    • If the file already has imports — merges or appends after the last one
    • If no imports exist in a .vue file — inserts below <script setup> (or <script>)
    • If no imports exist in a .ts/.js file — inserts at the beginning of the file
  4. Merges when the source matches an existing import: import { ref } + import { computed } from 'vue' becomes import { computed, ref } from 'vue'

Type imports are preserved inline: import { ref, type Ref } from 'vue'.

Examples

Vue 3 Component

Type vcRef then vcComputed:

<script setup lang="ts">
import { computed, ref } from 'vue';

const count = ref(0);
const doubled = computed(() => count.value * 2);
</script>

VueUse

Type vuUseMouse:

<script setup lang="ts">
import { useMouse } from '@vueuse/core';

const { x, y, sourceType } = useMouse();
</script>

Nuxt Data Fetching

Type vnAsyncData:

<script setup lang="ts">
const { data, pending, error } = await useAsyncData('posts', () => {
  return $fetch('/api/posts');
});
</script>

Development

npm install
npm run compile      # build extension
npm run compile-tests && npm test  # run 61 tests
npm run package      # production build

The import logic lives in src/imports.ts (pure functions, no VS Code dependency). The VS Code glue is in src/extension.ts. Tests are in src/test/extension.test.ts.

License

MIT

Links

  • VS Code Marketplace
  • GitHub
  • Issues
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft