Language server for unified

Downloads in past


6453.1.06 months ago4 years agoMinified + gzip package size for unified-language-server in KB


!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
Create a language server based on unified ecosystems.


*   [`createUnifiedLanguageServer(options)`](#createunifiedlanguageserveroptions)

What is this?

This package exports a function which can be used to create a language server
based on unified processors. It can do the following:
  • format documents based on a unified processor
  • validate documents based on a unified processor
  • support configuration files (such as .remarkrc) using
unified is a project that validates and transforms content with abstract syntax trees (ASTs). unified-engine is an engine to process multiple files with unified using configuration files. language server is a standardized language independent way for creating editor integrations.

When should I use this?

This package is useful when you want to create a language server for an existing unified ecosystem. Ideally this should follow the same rules as a CLI for this ecosystem created using unified-argsunified-args. The resulting package may then be used to create plugins for this ecosystem for various editors.


This package is ESM only. In Node.js (version 14.14+, or 16.0+), install with npm:
npm install unified-language-server


Let’s say you want to create a language server for remark.
Create a file names package.json with the following content:
  "name": "remark-language-server",
  "version": "1.0.0",
  "bin": "./index.js",
  "type": "module",
  "dependencies": {
    "remark": "^14.0.0",
    "unified-language-server": "^1.0.0"

Then create index.js with the following content:
import {remark} from 'remark'
import {createUnifiedLanguageServer} from 'unified-language-server'

process.title = 'remark-language-server'

  ignoreName: '.remarkignore',
  packageField: 'remarkConfig',
  pluginPrefix: 'remark',
  rcName: '.remarkrc',
  processorName: 'remark',
  processorSpecifier: 'remark',
  defaultProcessor: remark

That’s all there is to it. You have just created a language server for remark.



Create a language server for a unified ecosystem.
Configuration for unified-engine and the language server.
The package ID of the expected processor (string, required, example: 'remark'). Will be loaded from the local workspace.
The specifier to get the processor on the resolved module (string, optional, default: 'default'). For example, remark uses the specifier remark to expose its processor and a default export can be requested by passing 'default' (the default).
Optional fallback processor to use if processorName can’t be found locally in node_modules (Unifiedunified, optional). This can be used to ship a processor with your package, to be used if no processor is found locally. If this isn’t passed, a warning is shown if processorName can’t be found.
Name of ignore files to load (string, optional).
Property at which configuration can be found in package.json files (string, optional).
Optional prefix to use when searching for plugins (string, optional).
Plugins to use by default (Array|Object, optional).
Name of configuration files to load (string, optional).


For examples, see the following projects:
  • redot-language-server
(coming soon)
  • rehype-language-server
(coming soon)


This package is fully typed with TypeScript. It exports an Options type, which specifies the interface of the accepted options.

Language Server features

Language servers created using this package implement the following language server features:
  • textDocument/codeAction
— the language server implements code actions based on the `expected` field
on reported messages.
A code action can either insert, replace, or delete text based on the range
of the message and the expected value.
  • textDocument/didChange
— when a document is changed by the client, the language server processes it
using a unified pipeline.
Any messages collected are published to the client using
  • textDocument/didClose
— when a document is closed by the client, the language server resets
diagnostics by publishing an empty array using
  • textDocument/didOpen
— when a document is opened by the client, the language server processes it
using a unified pipeline.
Any messages collected are published to the client using
  • textDocument/formatting
— when document formatting is requested by the client, the language server
processes it using a unified pipeline.
The stringified result is returned.
  • workspace/didChangeWatchedFiles and workspace/didChangeWorkspaceFolders
— when the client signals a watched file or workspace has changed, the
language server processes all open files using a unified pipeline.
Any messages collected are published to the client using


Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+, and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed.
This project uses vscode-languageservervscode-languageserver 7, which implements language server protocol 3.17.0. It should work anywhere where LSP 3.6.0 or later is implemented.


— create pipeline for working with syntax trees
— create a CLI for a unified pipeline


See contributing.mdcontributing in unifiedjs/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.


MITlicense © @aecepogluauthor