unified-language-server provides a framework for building language servers based on the unified ecosystem. It allows developers to create editor integrations that format and validate documents using existing unified processors like remark (for Markdown) or rehype (for HTML). The current stable version is 4.0.1, with minor releases typically focusing on dependency updates and bug fixes, and major versions introducing breaking changes such as Node.js version requirements or significant internal refactors (e.g., using `unist-util-lsp`). Key differentiators include its tight integration with `unified-engine` for configuration file support (like `.remarkrc`) and its ability to work with any unified processor, simplifying the creation of LSP-compliant tools for AST transformations. It supports features like document formatting, validation, and quick fixes.
npm install unified-language-serverVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to create a basic language server for `remark` using `unified-language-server`, including configuration options for file handling.
Upgrade your Node.js runtime to version 16.0 or newer.
Update imports to use `import` statements and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).
Review existing configuration files (`.remarkrc`, etc.) to ensure compatibility with `unified-engine`'s updated YAML parser. Update YAML configurations if necessary.
No direct fix needed for standard usage. If you have custom extensions interacting with internal structures, verify compatibility or consult the `unist-util-lsp` documentation.
Always ensure that the `processorName` specified (e.g., `remark`) is correctly listed and installed as a dependency in your language server's `package.json` or the user's project `node_modules`.
Change `const { createUnifiedLanguageServer } = require('unified-language-server');` to `import { createUnifiedLanguageServer } from 'unified-language-server';` and ensure `"type": "module"` is set in your `package.json`.Ensure the processor package (e.g., `remark`) is listed in your language server's `dependencies` and run `npm install`.
Verify that `defaultProcessor` receives a valid `unified` processor instance (e.g., `remark`) and that its named export is correctly imported (e.g., `import { remark } from 'remark';`).Ensure both the `unified-language-server` package and the editor client integration are updated to their latest versions to support all configuration features.