|
| 1 | + [What is this?](#what-is-this) |
| 2 | + * [When should I use this?](#when-should-i-use-this) |
| 3 | + * [Install](#install) |
| 4 | + * [Use](#use) |
| 5 | + * [API](#api) |
| 6 | + * [`createUnifiedLanguageServer(options)`](#createunifiedlanguageserveroptions) |
| 7 | + * [Examples](#examples) |
| 8 | + * [Types](#types) |
| 9 | + * [Language Server features](#language-server-features) |
| 10 | + * [Watching files](#watching-files) |
| 11 | + * [Requests](#requests) |
| 12 | + * [Configuration](#configuration) |
| 13 | + * [Compatibility](#compatibility) |
| 14 | + * [Related](#related) |
| 15 | + * [Contribute](#contribute) |
| 16 | + * [License](#license) |
| 17 | + * [What is this?](#what-is-this) |
| 18 | + * [When should I use this?](#when-should-i-use-this) |
| 19 | + * [Install](#install) |
| 20 | + * [Use](#use) |
| 21 | + * [API](#api) |
| 22 | + * [`createUnifiedLanguageServer(options)`](#createunifiedlanguageserveroptions) |
| 23 | + * [Examples](#examples) |
| 24 | + * [Types](#types) |
| 25 | + * [Language Server features](#language-server-features) |
| 26 | + * [Watching files](#watching-files) |
| 27 | + * [Requests](#requests) |
| 28 | + * [Configuration](#configuration) |
| 29 | + * [Compatibility](#compatibility) |
| 30 | + * [Related](#related) |
| 31 | + * [Contribute](#contribute) |
| 32 | + * [License](#license) |
| 33 | + |
| 34 | + ## What is this? |
| 35 | + |
| 36 | + This package exports a function which can be used to create a |
| 37 | + [language server][] based on [unified][] processors. |
| 38 | + It can do the following: |
| 39 | + |
| 40 | + * format documents based on a unified processor |
| 41 | + * validate documents based on a unified processor |
| 42 | + * support configuration files (such as `.remarkrc`) using |
| 43 | + [`unified-engine`][unified-engine] |
| 44 | + * format documents based on a unified processor |
| 45 | + * validate documents based on a unified processor |
| 46 | + * support configuration files (such as `.remarkrc`) using |
| 47 | + [`unified-engine`][unified-engine] |
| 48 | + |
| 49 | + **unified** is a project that validates and transforms content with abstract |
| 50 | + syntax trees (ASTs). |
| 51 | + @@ -58,7 +58,7 @@ various editors. |
| 52 | + |
| 53 | + ## Install |
| 54 | + |
| 55 | + This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). |
| 56 | + This package is [ESM only][]. |
| 57 | + In Node.js (version 16.0+), install with [npm][]: |
| 58 | + |
| 59 | + ```sh |
| 60 | + @@ -162,11 +162,11 @@ Name of configuration files to load (`string`, optional). |
| 61 | + |
| 62 | + For examples, see the following projects: |
| 63 | + |
| 64 | + * `redot-language-server` |
| 65 | + (coming soon) |
| 66 | + * `rehype-language-server` |
| 67 | + (coming soon) |
| 68 | + * [`remark-language-server`](https://github.com/remarkjs/remark-language-server) |
| 69 | + * `redot-language-server` |
| 70 | + (coming soon) |
| 71 | + * `rehype-language-server` |
| 72 | + (coming soon) |
| 73 | + * [`remark-language-server`](https://github.com/remarkjs/remark-language-server) |
| 74 | + |
| 75 | + ## Types |
| 76 | + |
| 77 | + @@ -187,39 +187,39 @@ change was made. |
| 78 | + Language servers created using this package implement the following language |
| 79 | + server features: |
| 80 | + |
| 81 | + * `textDocument/codeAction` |
| 82 | + — the language server implements code actions based on the `expected` field |
| 83 | + on reported messages. |
| 84 | + A code action can either insert, replace, or delete text based on the range |
| 85 | + of the message and the expected value. |
| 86 | + * `textDocument/didChange` |
| 87 | + — when a document is changed by the client, the language server processes it |
| 88 | + using a unified pipeline. |
| 89 | + Any messages collected are published to the client using |
| 90 | + `textDocument/publishDiagnostics`. |
| 91 | + * `textDocument/didClose` |
| 92 | + — when a document is closed by the client, the language server resets |
| 93 | + diagnostics by publishing an empty array using |
| 94 | + `textDocument/publishDiagnostics`. |
| 95 | + * `textDocument/didOpen` |
| 96 | + — when a document is opened by the client, the language server processes it |
| 97 | + using a unified pipeline. |
| 98 | + Any messages collected are published to the client using |
| 99 | + `textDocument/publishDiagnostics`. |
| 100 | + * `textDocument/formatting` |
| 101 | + — when document formatting is requested by the client, the language server |
| 102 | + processes it using a unified pipeline. |
| 103 | + The stringified result is returned. |
| 104 | + * `workspace/didChangeWatchedFiles` and `workspace/didChangeWorkspaceFolders` |
| 105 | + — when the client signals a watched file or workspace has changed, the |
| 106 | + language server processes all open files using a unified pipeline. |
| 107 | + Any messages collected are published to the client using |
| 108 | + `textDocument/publishDiagnostics`. |
| 109 | + * `textDocument/codeAction` |
| 110 | + — the language server implements code actions based on the `expected` field |
| 111 | + on reported messages. |
| 112 | + A code action can either insert, replace, or delete text based on the range |
| 113 | + of the message and the expected value. |
| 114 | + * `textDocument/didChange` |
| 115 | + — when a document is changed by the client, the language server processes it |
| 116 | + using a unified pipeline. |
| 117 | + Any messages collected are published to the client using |
| 118 | + `textDocument/publishDiagnostics`. |
| 119 | + * `textDocument/didClose` |
| 120 | + — when a document is closed by the client, the language server resets |
| 121 | + diagnostics by publishing an empty array using |
| 122 | + `textDocument/publishDiagnostics`. |
| 123 | + * `textDocument/didOpen` |
| 124 | + — when a document is opened by the client, the language server processes it |
| 125 | + using a unified pipeline. |
| 126 | + Any messages collected are published to the client using |
| 127 | + `textDocument/publishDiagnostics`. |
| 128 | + * `textDocument/formatting` |
| 129 | + — when document formatting is requested by the client, the language server |
| 130 | + processes it using a unified pipeline. |
| 131 | + The stringified result is returned. |
| 132 | + * `workspace/didChangeWatchedFiles` and `workspace/didChangeWorkspaceFolders` |
| 133 | + — when the client signals a watched file or workspace has changed, the |
| 134 | + language server processes all open files using a unified pipeline. |
| 135 | + Any messages collected are published to the client using |
| 136 | + `textDocument/publishDiagnostics`. |
| 137 | + |
| 138 | + ### Configuration |
| 139 | + |
| 140 | + * `requireConfig` (default: `false`) |
| 141 | + — If true, files will only be checked if a configuration file is present. |
| 142 | + * `requireConfig` (default: `false`) |
| 143 | + — If true, files will only be checked if a configuration file is present. |
| 144 | + |
| 145 | + ## Compatibility |
| 146 | + |
| 147 | + @@ -234,10 +234,10 @@ It should work anywhere where LSP 3.6.0 or later is implemented. |
| 148 | + |
| 149 | + ## Related |
| 150 | + |
| 151 | + * [`unified`](https://github.com/unifiedjs/unified) |
| 152 | + — create pipeline for working with syntax trees |
| 153 | + * [`unified-args`](https://github.com/unifiedjs/unified-args) |
| 154 | + — create a CLI for a unified pipeline |
| 155 | + * [`unified`](https://github.com/unifiedjs/unified) |
| 156 | + — create pipeline for working with syntax trees |
| 157 | + * [`unified-args`](https://github.com/unifiedjs/unified-args) |
| 158 | + — create a CLI for a unified pipeline |
| 159 | + |
| 160 | + ## Contribute |
| 161 | + |
| 162 | + @@ -267,6 +267,8 @@ abide by its terms. |
| 163 | + |
| 164 | + [downloads]: https://www.npmjs.com/package/unified-language-server |
| 165 | + |
| 166 | + [esm only]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
| 167 | + |
| 168 | + [size-badge]: https://img.shields.io/bundlephobia/minzip/unified-language-server.svg |
| 169 | + |
| 170 | + [size]: https://bundlephobia.com/result?p=unified-language-server |
0 commit comments