Language Servers Guide
Configure language servers for coc.nvim, compare supported connection modes and features, and browse practical server setup examples by language.
coc.nvim project documentation · Content sources and maintainers
Edit this pageSupported features
See the official LSP specification.
Note: Capabilities vary between servers.
Register custom language servers
Configure user-defined language servers in the languageserver field of the configuration file. See :h coc-config-languageserver
for common language server settings.
There are three types of language servers: module, executable, and socket.
modulelanguage servers run on Node.js and communicate over Node.js IPC.executablelanguage servers are launched with an executable command and communicate over stdio.socketlanguage servers run in a separate process and are typically used for debugging.
Each language server type has its own configuration schema.
Example configuration for a module language server:
| 1 | "languageserver": { |
| 2 | "foo": { |
| 3 | "module": "/usr/local/lib/node_modules/foo/index.js", |
| 4 | "args": ["--node-ipc"], |
| 5 | "filetypes": ["foo"], |
| 6 | "trace.server": "verbose", |
| 7 | "rootPatterns": ["root.yml"], |
| 8 | // Used for debugging Node.js |
| 9 | // "execArgv": ["--nolazy", "--inspect-brk=6045"], |
| 10 | "initializationOptions": { |
| 11 | }, |
| 12 | "settings": { |
| 13 | "validate": true |
| 14 | } |
| 15 | } |
| 16 | } |
module and filetypes are required for a module language server.
Example configuration for an executable language server:
| 1 | "languageserver": { |
| 2 | "bar": { |
| 3 | "command": "bar", |
| 4 | "args": ["--stdio"], |
| 5 | "filetypes": ["bar"], |
| 6 | "cwd": "./src", |
| 7 | "initializationOptions": { |
| 8 | }, |
| 9 | "settings": { |
| 10 | } |
| 11 | } |
| 12 | } |
command and filetypes are required for an executable language server.
Example configuration for a socket language server:
| 1 | "languageserver": { |
| 2 | "socketserver": { |
| 3 | "host": "127.0.0.1", |
| 4 | "port": 9527 |
| 5 | } |
| 6 | } |
port is required for a socket service. Start the socket server before coc.nvim starts.
Install coc-json for completion and validation support.
Browse the language server catalog
The catalog contains practical configuration examples for more than 50 language servers. Use the language server catalog to search by language or server name, then return here for connection modes, feature support, and configuration rules.