Home / Blog / Vue Language Tools: Volar, TypeScript, and the Official VSCode Extension
Vue Language Tools: Volar, TypeScript, and the Official VSCode Extension

Vue Language Tools: Volar, TypeScript, and the Official VSCode Extension

Mostafa Said
Mostafa Said
September 16th 2024

Vue.js is not just a framework—it’s an ecosystem. One of the critical components that makes Vue a developer-friendly platform is its suite of language tools that streamline the coding experience. At the core of this is the Vue Language Tools, which houses key tools and packages designed to integrate seamlessly with IDEs like VSCode, optimizing development workflows for Vue.js.

In this article, we'll take a deep dive into the various packages found within this repository, the official Vue - Official extension powered by Volar, and explore the evolution of Volar itself. This comprehensive guide will help you understand why these tools are indispensable for Vue developers.

Introduction to Vue Language Tools

The Vue Language Tools repository is essential for providing language features such as autocompletion, type checking, and diagnostics when working with Vue’s Single File Components (SFCs). These tools are critical for ensuring a smooth and error-free development experience. As the ecosystem grows more sophisticated, this repository has evolved to offer more advanced support for Vue 3, especially in combination with TypeScript.

Before we explore the language tools, let’s discuss Volar, the key tool that enabled this language support.

Volar: The Backbone of Vue’s Language Tools

Initially, Volar was created by Johnson Chu, Volar is now the official engine powering Vue’s IDE support, especially for VSCode. Volar provides advanced language support for Vue 3 projects, with a strong emphasis on TypeScript, autocompletion, and intelligent diagnostics. By integrating directly into editors like VSCode, Volar ensures that developers have access to features like real-time type-checking, go-to-definition, and template type inference.

The Vue - Official extension on the VSCode marketplace is built on top of Volar, and it offers the full range of Vue language features for a seamless development experience.

If you've been part of the Vue ecosystem for a while, you probably remember the VSCode extension being called Volar. Then, almost out of the blue, it was renamed to Vue - Official. So, what’s up with that?

The Evolution of Volar

Volar started as a personal project aimed at improving Vue 3 support in VSCode, especially for TypeScript-heavy projects. Over time, it became the foundation for all Vue language tooling. Its success and growth led to its adoption as the core behind the Vue - Official extension.

One of the major milestones in Volar's development was the introduction of Volar.js, a framework-agnostic language toolkit. This shift allowed Volar to not only support Vue but also extend its capabilities to other frameworks, including Svelte, Astro, and Angular. The flexibility of Volar.js has made the tooling ecosystem more modular and easier to maintain, while continuing to improve Vue-specific features.

The Key Packages in Vue Language Tools

Ok, back to the language tools. Let’s explore some of the most important ones:

1. vue-tsc

For developers working with TypeScript, vue-tsc is a must-have. It’s a command-line tool that enables type-checking in Vue 3 projects. By running vue-tsc --noEmit, you can get TypeScript type-checking without needing to emit any actual JavaScript code. This tool is especially useful in Continuous Integration (CI) environments where you want to ensure your code is type-safe before pushing to production.

TypeScript has become increasingly popular among Vue developers, and vue-tsc makes it easy to catch type errors early, improving code quality and maintainability.

The vue-tsc package is automatically included when you create a new Vite-powered Vue.js project using the create-vue tool.

2. @vue/language-server

The Vue Language Server is the core component that provides a rich set of language features based on the Language Server Protocol (LSP). This package is the engine behind many of the real-time features developers rely on in their IDEs—such as autocompletion, hover information, diagnostics, and go-to-definition for Vue's SFCs. This powerful tool works under the hood in editors like VSCode to provide you with feedback as you code.

3. The Vue Official Extension for VSCode

While Volar powers the language tools, the official extension for Vue is titled Vue - Official on the VSCode marketplace. This extension is crucial for Vue developers, as it integrates all the rich features from the language tools directly into the VSCode editor.

With this extension, developers benefit from:

  • Enhanced TypeScript support: Volar brings native TypeScript support to your Vue 3 files, enabling real-time type checking, better autocompletion, and error checking.
  • Template Type Inference: Volar's advanced type inference can detect types directly from your Vue templates, offering developers more precise type feedback as they write their components.
  • Diagnostic Tools: It catches common issues in your Vue components early, offering suggestions for fixes while you code.
  • Performance Improvements: The extension is optimized for large codebases, so even enterprise-level applications will perform smoothly in the editor.

And that’s just the beginning! You can keep track of all the cool features added via the changelog.

Conclusion

Vue's language tools have come a long way, with Volar and the Vue - Official extension playing a critical role in enhancing the development experience. These tools make it easier to catch errors, improve code quality, and streamline your workflow, particularly when working with TypeScript.

Check out our Visual Studio Code for Vue.js Developers course and level up your VSCode skills for Vue like a pro.

Start learning Vue.js for free

Mostafa Said
Mostafa Said
With over 7 years of e-learning expertise honed at major companies like Vodafone Intelligent Solutions (_VOIS), Mostafa is full-time instructor at Vue School and a full-stack developer in the wild. He built and maintained dozens of apps using Vue, Nuxt, Laravel, Tailwind, and more. He merges modern teaching methods with coding education to empower aspiring developers of all experience levels. When he's not glued to the code editor, hackathons fuel his competitive spirit, with Deepgram and Appwrite grand prizes under his belt.

Comments

Latest Vue School Articles

10 Practical Tips for Better Vue Apps

10 Practical Tips for Better Vue Apps

Take your Vue.js skills to the next level with these 10 practical tips including: script setup, provide/inject, defineExpose, toRefs, and more
Daniel Kelly
Daniel Kelly
Building a “Procrastination Timer” with Vue 3 Composition API

Building a “Procrastination Timer” with Vue 3 Composition API

Learn to build a timer app with Vue.js and get a first hand look at how well Claude.ai understands the Vue Composition API
Daniel Kelly
Daniel Kelly

Our goal is to be the number one source of Vue.js knowledge for all skill levels. We offer the knowledge of our industry leaders through awesome video courses for a ridiculously low price.

More than 200.000 users have already joined us. You are welcome too!

Follow us on Social

© All rights reserved. Made with ❤️ by BitterBrains, Inc.