Vue Language Server (VLS)

0.8.5 · deprecated · verified Sun Apr 19

The `vls` (Vue Language Server) package provides a Language Server Protocol (LSP) implementation specifically for Vue.js projects. Its primary role was to power editor extensions like Vetur in VS Code, offering features such as intelligent code completion, diagnostics, syntax highlighting, and formatting for Vue Single File Components (SFCs). The `vls` npm package itself is currently at version `0.8.5` and has not received significant updates for several years, indicating a stagnant development pace for the standalone package. While Vetur, which historically consumed `vls`, continued to evolve for a time (reaching versions like `0.37.x`), the broader Vue ecosystem, particularly with the advent of Vue 3, has largely transitioned to Volar as the recommended language server due to its more comprehensive and official support for modern Vue 3 features like `<script setup>` and enhanced TypeScript integration. As a result, `vls` is primarily relevant for older Vue 2 projects or as a foundational component for historical language tooling, with limited utility for current Vue 3 development.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install VLS globally via CLI and conceptually how a language client would spawn the `vls` server process for LSP communication.

npm install -g vls

# Verify installation and server functionality
vls --version

# Example of how a language client might launch it (conceptual)
const { spawn } = require('child_process');
const path = require('path');

const vlsPath = require.resolve('vls/dist/vueServerMain');
console.log(`Attempting to start VLS from: ${vlsPath}`);

const serverProcess = spawn('node', [vlsPath], {
  stdio: ['pipe', 'pipe', 'pipe'] // stdin, stdout, stderr for LSP communication
});

serverProcess.stdout.on('data', (data) => {
  console.log(`VLS STDOUT: ${data.toString().trim()}`);
});

serverProcess.stderr.on('data', (data) => {
  console.error(`VLS STDERR: ${data.toString().trim()}`);
});

serverProcess.on('exit', (code) => {
  console.log(`VLS process exited with code ${code}`);
});

// In a real client, you'd send LSP messages to serverProcess.stdin
// and parse responses from serverProcess.stdout.

view raw JSON →