{"id":12389,"library":"volar-service-yaml","title":"Volar YAML Language Service","description":"volar-service-yaml is a dedicated Volar plugin designed to integrate the robust `yaml-language-server` into Volar-powered development environments. This integration provides comprehensive language features for YAML files, including syntax highlighting, intelligent auto-completion, real-time schema validation, and diagnostic reporting, directly within projects utilizing Volar's language service, commonly found in Vue.js applications. Currently at version 0.0.70, this package primarily acts as a bridge, enabling sophisticated YAML tooling to function seamlessly within Volar's architecture. Its release cadence is generally synchronized with updates to the main Volar language service (specifically targeting `~2.4.0`), ensuring ongoing compatibility and leveraging an established, widely used YAML language server to offer superior developer experience for YAML configuration files within the Volar ecosystem.","status":"active","version":"0.0.70","language":"javascript","source_language":"en","source_url":"https://github.com/volarjs/services","tags":["javascript","volar-service","typescript"],"install":[{"cmd":"npm install volar-service-yaml","lang":"bash","label":"npm"},{"cmd":"yarn add volar-service-yaml","lang":"bash","label":"yarn"},{"cmd":"pnpm add volar-service-yaml","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core peer dependency for Volar language service functionality. This plugin integrates into Volar's architecture.","package":"@volar/language-service","optional":false}],"imports":[{"note":"For ESM environments or TypeScript projects. Volar v2 is ESM-first, so this is the recommended import style.","wrong":"import volarServiceYaml from 'volar-service-yaml';\n// or\nimport { default as create } from 'volar-service-yaml';","symbol":"create","correct":"import { create } from 'volar-service-yaml';"},{"note":"CommonJS named import for Node.js environments, often used in `volar.config.js` files.","wrong":"const create = require('volar-service-yaml').create;","symbol":"create","correct":"const { create } = require('volar-service-yaml');"},{"note":"This is a type import for defining a Volar service plugin, primarily for type-checking and autocompletion when creating custom services. Although not directly from `volar-service-yaml`, it's crucial for Volar plugin development.","symbol":"ServicePlugin","correct":"import type { ServicePlugin } from '@volar/language-service';"}],"quickstart":{"code":"/* volar.config.js */\nmodule.exports = {\n\tservices: [\n\t\trequire('volar-service-yaml').create(),\n\t],\n};\n\n// For a TypeScript-based Volar config (e.g., volar.config.ts with ts-node):\n// import { create } from 'volar-service-yaml';\n// import type { VolarConfig } from '@volar/language-service';\n// export default <VolarConfig>{\n// \tservices: [\n// \t\tcreate(),\n// \t],\n// };","lang":"javascript","description":"Demonstrates how to integrate the YAML language service into your Volar configuration file to enable YAML features."},"warnings":[{"fix":"Ensure your project and VSCode extension ('Vue - Official') are running Volar v2.x or newer. Migrate your Volar configuration if coming from v1.x.","message":"This plugin is designed for Volar v2.x and is not compatible with Volar v1.x (or the legacy 'Volar Language Features' VSCode extension). Attempting to use it with older Volar versions will lead to failures.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Stick to `require('volar-service-yaml').create()` in `volar.config.js`. If you use `volar.config.ts` with `ts-node` or similar, ESM imports (`import { create } from 'volar-service-yaml';`) might be necessary, but verify your specific setup.","message":"The `volar.config.js` file typically runs in a CommonJS environment, even if your project is otherwise ESM-enabled. Use `require()` for importing plugins within this configuration file.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Review the documentation for `yaml-language-server` on how to configure schemas (e.g., via `.vscode/settings.json` or directly in YAML files) relevant to your project's YAML files.","message":"Incorrect or missing YAML schemas can lead to inaccurate diagnostics and missing auto-completion. The YAML Language Server relies on properly configured schemas.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install volar-service-yaml` or `yarn add volar-service-yaml`. Double-check the import/require path. If using a custom Volar config, ensure Node.js can resolve the module in that context.","cause":"The package is not installed or the import path is incorrect, or there's a module resolution issue in a mixed CJS/ESM project.","error":"Error: Cannot find module 'volar-service-yaml'"},{"fix":"Ensure you are using the correct import syntax for your module environment. For `volar.config.js`, use `require('volar-service-yaml').create()`. For ESM TypeScript, use `import { create } from 'volar-service-yaml';`.","cause":"This typically indicates an ESM/CommonJS interop issue where a CommonJS `require` is trying to access a named export like a default export, or vice-versa, or incorrect bundling.","error":"TypeError: (0 , volar_service_yaml_1.create) is not a function"},{"fix":"Check your editor's output channels for detailed errors from the Volar language server or the YAML language server. Verify your YAML files for syntax errors or invalid schema references. Ensure no conflicting YAML extensions are active.","cause":"The underlying `yaml-language-server` might be failing to start or encountering configuration errors.","error":"Volar service 'yaml' failed to initialize: [...]"}],"ecosystem":"npm"}