Skip to content
JohanG-75 edited this page Sep 27, 2024 · 291 revisions

Contents

Supported features

Check out the official LSP specification.

Note: different servers can have different capabilities.

Register custom language servers

User defined language servers are configured in the languageserver field of the configuration file. See :h coc-config-languageserver for common language server configuration settings.

There are three types of language servers: module, executable, and socket.

  • module type language servers are run by node.js and using node IPC for connection.
  • executable type language servers are spawned with an executable command while using stdio for connection.
  • socket language servers are started in a separate process, normally used for debugging purposes.

Different language server types have different configuration schema.

An example of module language server:

"languageserver": {
  "foo": {
    "module": "/usr/local/lib/node_modules/foo/index.js",
    "args": ["--node-ipc"],
    "filetypes": ["foo"],
    "trace.server": "verbose",
    "rootPatterns": ["root.yml"],
    // Used for debugging NodeJS
    // "execArgv": ["--nolazy", "--inspect-brk=6045"],
    "initializationOptions": {
    },
    "settings": {
      "validate": true
    }
  }
}

module and filetypes are required for module language server.

An example of executable language server:

"languageserver": {
  "bar": {
    "command": "bar",
    "args": ["--stdio"],
    "filetypes": ["bar"],
    "cwd": "./src",
    "initializationOptions": {
    },
    "settings": {
    }
  }
}

command and filetypes are required for executable language server.

An example of socket language server:

"languageserver": {
    "socketserver": {
      "host": "127.0.0.1",
      "port": 9527
    }
  }

port is required for a socket service and user should start the socket server before coc starts.

Install coc-json for completion and validation support.

Example language server configuration

Add languageserver section in your coc-settings.json for registering custom language servers.

Ada/SPARK

Using Ada Language Server. See installation instructions on the Github homepage of this LSP.

Via coc-als, or:

"languageserver": {
  "Ada": {
    "command": "path/to/ada_language_server",
    "filetypes": ["ada"]
  }
}

Apachecamel

Use coc-camel

:CocInstall coc-camel

Arduino

Using Arduino Language Server. See the installation instructions in the README file of this LSP.

"languageserver":{
  "arduino":{ 
    "command":"/path/to/arduino-language-server",
    "rootPatterns":["*.ino"],
    "filetypes":["arduino"],
    "args":["-cli", "/path/to/arduino-cli", "-clangd", "/path/to/clangd", "-cli-config", "/path/to/arduino-cli.yaml", "-fqbn", "board:name"],
    "disabledFeatures":["semanticTokens"]
  }
}

Tips:

  • This LSP requires clangd and arduino-cli to work properly. Modify the values according to the locations of the binaries on your machine.
  • To determine (or generate if there isn't one) the location of arduino-cli.yaml, refer to this page.

Bash

Via coc-sh or

Using mads-hartmann/bash-language-server

"languageserver": {
  "bash": {
    "command": "bash-language-server",
    "args": ["start"],
    "filetypes": ["sh"]
  }
}

Bitbake

Via bitbake-language-server

"languageserver": {
  "bitbake": {
    "command": "bitbake-language-server",
    "filetypes": ["bitbake"]
  },
}

Blueprint

Using blueprint-compiler

"languageserver": {
  "blueprint": {
    "command": "blueprint-compiler",
    "args": ["lsp"],
    "filetypes": ["blueprint", "blp"]
  },
}

C/C++/Objective-C

Using clangd with coc-clangd or:

"languageserver": {
  "clangd": {
    "command": "clangd",
    "rootPatterns": ["compile_flags.txt", "compile_commands.json"],
    "filetypes": ["c", "cc", "cpp", "c++", "objc", "objcpp"]
  }
}

Like many tools, clangd relies on the presence of a JSON compilation database

Using ccls

"languageserver": {
  "ccls": {
    "command": "ccls",
    "filetypes": ["c", "cc", "cpp", "c++", "objc", "objcpp"],
    "rootPatterns": [".ccls", "compile_commands.json", ".git/", ".hg/"],
    "initializationOptions": {
        "cache": {
          "directory": "/tmp/ccls"
        }
      }
  }
}

To make header completion work with clang < 8 on Mac OS X, use "initializationOptions" like:

"initializationOptions": {
  "cache": {
    "directory": "/tmp/ccls"
  },
  "clang": {
      // make sure you have installed commandLineTools
    "resourceDir": "/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0",
    "extraArgs": [
      "-isystem",
      "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
      "-I",
      "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"
    ]
  }
},

Using cquery

"languageserver": {
  "cquery": {
    "command": "cquery",
    "args": ["--log-file=/tmp/cq.log"],
    "filetypes": ["c", "cc", "cpp", "c++"],
    "rootPatterns": ["compile_flags.txt", "compile_commands.json", ".git/", ".hg/"],
    "initializationOptions": {
      "cacheDirectory": "/tmp/cquery"
    }
  }
}

CMake

Try coc-cmake (not implemented with LSP) or

Using cmake-language-server

"languageserver": {
  "cmake": {
    "command": "cmake-language-server",
    "filetypes": ["cmake"],
    "rootPatterns": [
      "build/"
    ],
    "initializationOptions": {
      "buildDirectory": "build"
    }
  }
}

Common Lisp

Use coc-cl

:CocInstall coc-cl

Clojure

Use coc-clojure

:CocInstall coc-clojure

Crystal

Using crystalline. Follow the instructions to install it.

  "languageserver": {
    "crystal": {
      "command": "crystalline",
      "args": [
        "--stdio"
      ],
      "filetypes": [
        "crystal"
      ]
    }
  }

Make sure you have crystalline available in your PATH

CSS/Less/Sass

Use coc-css is recommended.

Dart

One option is use coc-flutter, that leverages analysis_server from dart-sdk.

Another option is configure analysis_server yourself. Use analysis_server from dart-sdk:

"languageserver": {
  "dart": {
    "command": "dart",
    "args": [
      " change this to the path of analysis_server
      "/usr/local/opt/dart/libexec/bin/snapshots/analysis_server.dart.snapshot",
      "--lsp",
      "--client-id",
      "vim",
      "--client-version",
      "coc.nvim",
    ],
    "filetypes": ["dart"],
    "trace.server": "verbose"
  },
}

Or use natebosch/dart_language_server

"languageserver": {
  "dart": {
    "command": "dart_language_server", // in windows is dart_language_server.bat
    "args": [],
    "filetypes": ["dart"],
    "initializationOptions": {},
    "settings": {
      "dart": {
        "validation": {},
        "completion": {}
      }
    }
  }
}

D

Use coc-dlang

:CocInstall coc-dlang

Deno

Use coc-deno

:CocInstall coc-deno

Dhall

Using dhall-lsp-server. Follow the instructions to install it.

"languageserver": {
  "dhall": {
    "command": "dhall-lsp-server",
    "filetypes": [
      "dhall"
    ]
  }
}

Dockerfile

Using rcjsuen/dockerfile-language-server-nodejs

"languageserver": {
  "dockerfile": {
    "command": "docker-langserver",
    "filetypes": ["dockerfile"],
    "args": ["--stdio"]
  }
}

Docker Compose

Using microsoft/compose-language-service

First, set the filetype of docker-compose.yml and compose.yml to yaml.docker-compose in vimrc or init.vim. Also set g:coc_filetype_map to map yaml.docker-compose to dockercompose.

Set the .vimrc or init.vim:

au FileType yaml if bufname("%") =~# "docker-compose.yml" | set ft=yaml.docker-compose | endif
au FileType yaml if bufname("%") =~# "compose.yml" | set ft=yaml.docker-compose | endif

let g:coc_filetype_map = {
  \ 'yaml.docker-compose': 'dockercompose',
  \ }

Installing a Language Server:

npm i -g @microsoft/compose-language-service

Set the coc-settings.json:

{
  "languageserver": {
    "dockercompose": {
      "command": "docker-compose-langserver",
      "args": ["--stdio"],
      "filetypes": ["dockercompose"],
      "rootPatterns": [".git", ".env", "docker-compose.yml", "compose.yml"]
    }
  }
}

Elixir

Using elixir-ls

If you want to use @spec suggestions you have to enable codelens.

"codeLens.enable": true,
"languageserver": {
  "elixirLS": {
    "command": "/absolute/path/to/elixir-ls/release/language_server.sh",
    "filetypes": ["elixir", "eelixir"]
  }
}

Elvish

Using the builtin language server

{
  "languageserver": {
    "elvish": {
      "command": "elvish",
      "args": ["-lsp"],
      "filetypes": ["elvish"]
    }
  }
}

Erlang

Using erlang_ls

Assuming that erlang_ls is in the execution path

"languageserver": {
  "erlang": {
    "command": "erlang_ls",
    "filetypes": ["erlang"]
  }
}

Elm

Using elm-tooling/elm-language-server

"languageserver": {
  "elmLS": {
    "command": "elm-language-server",
    "filetypes": ["elm"],
    "rootPatterns": ["elm.json"],
    "initializationOptions": {
      "elmPath": "elm", // optional
      "elmFormatPath": "elm-format", // optional
      "elmTestPath": "elm-test", // optional
      "elmAnalyseTrigger": "change" // optional
    }
  }
}

elm-language-server needs elm, elm-format and elm-test

  • If a path like elmPath is defined, it'll be used.
  • If a path is missing, elm-language-server will try to load it from a local npm installation folder. Otherwise a global installation provided via PATH is used.
  • elmAnalyseTrigger: elm-analyse (linting) is executed on 'change', 'save' or 'never' (default: 'change')

Check out github page for more information.

Flow

Using flow-language-server (Note: project no longer maintained)

// disable tsserver for javascript
"tsserver.enableJavascript": false,
"languageserver": {
  "flow": {
    "command": "flow-language-server",
    "args": ["--stdio"],
    "filetypes": ["javascript", "javascriptreact"],
    "rootPatterns": [".flowconfig"]
  },
}

Using flow lsp

"languageserver": {
  "flow": {
    "command": "flow",
    "args": ["lsp"],
    "filetypes": ["javascript", "javascriptreact"],
    "initializationOptions": {},
    "requireRootPattern": true,
    "settings": {},
    "rootPatterns": [".flowconfig"]
  }
},

Fortran

Using fortran-language-server

Make sure the fortls executable is available on your $PATH.

"languageserver": {
  "fortran": {
    "command": "fortls",
    "filetypes": ["fortran"],
    "rootPatterns": [".fortls", ".git/"]
  }
}

FSharp

Install FsAutoComplete

dotnet tool install --global fsautocomplete

Associate F# file extensions with fsharp

autocmd BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp

"languageserver": {
  "fsharp": {
    "command": "fsautocomplete",
    "args": [],
    "filetypes": ["fsharp"],
    "trace.server": "verbose",
    "initializationOptions": {
      "AutomaticWorkspaceInit": true
    },
    "settings": {
      "FSharp.keywordsAutocomplete": true,
      "FSharp.ExternalAutocomplete": false,
      "FSharp.Linter": true,
      "FSharp.UnionCaseStubGeneration": true,
      "FSharp.UnionCaseStubGenerationBody": "failwith \"Not Implemented\"",
      "FSharp.RecordStubGeneration": true,
      "FSharp.RecordStubGenerationBody": "failwith \"Not Implemented\"",
      "FSharp.InterfaceStubGeneration": true,
      "FSharp.InterfaceStubGenerationObjectIdentifier": "this",
      "FSharp.InterfaceStubGenerationMethodBody": "failwith \"Not Implemented\"",
      "FSharp.UnusedOpensAnalyzer": true,
      "FSharp.UnusedDeclarationsAnalyzer": true,
      "FSharp.UseSdkScripts": true,
      "FSharp.SimplifyNameAnalyzer": false,
      "FSharp.ResolveNamespaces": true,
      "FSharp.EnableReferenceCodeLens": true
    }
  }
}

Gleam

Using the builtin language server

{
  "languageserver": {
    "gleam": {
      "command": "gleam",
      "args": ["lsp"],
      "filetypes": ["gleam"]
    }
  }
}

Go

Via coc-go or

Using gopls

"languageserver": {
  "golang": {
    "command": "gopls",
    "rootPatterns": ["go.mod"],
    "filetypes": ["go"]
  }
}

If want more debug,add "args": ["serve", "-debug", "0.0.0.0:8484", "-rpc.trace"], below command.

Using sourcegraph/go-langserver

"languageserver": {
  "golang": {
    "command": "go-langserver",
    "filetypes": ["go"],
    "initializationOptions": {
      "gocodeCompletionEnabled": true,
      "diagnosticsEnabled": true,
      "lintTool": "golint"
    }
  }
}

Godot

"languageserver": {
    "godot": {
      "host": "127.0.0.1",
      "filetypes": ["gd", "gdscript", "gdscript3"],
      "port": 6008
    }
}

GraphQL

Using graphql-language-service-cli

"languageserver": {
  "graphql": {
    "command": "graphql-lsp",
    "args": ["server", "-m", "stream"],
    // customize filetypes to your needs
    "filetypes": ["typescript", "typescriptreact", "graphql"]
  }
}

Groovy

Using Language server for Groovy. Check out sources, build it and place groovy-language-server-all.jar to any folder.

"languageserver": {
  "groovy": {
    "command": "java",
    "args" : ["-jar", "/path/to/groovy-language-server-all.jar"],
    "filetypes": ["groovy"]
  }
}

Haskell

Using Haskell Language Server

"languageserver": {
  "haskell": {
    "command": "haskell-language-server-wrapper",
    "args": ["--lsp"],
    "rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
    "filetypes": ["haskell", "lhaskell"],
    // Settings are optional, here are some example values
    "settings": {
      "haskell": {
        "checkParents": "CheckOnSave",
        "checkProject": true,
        "maxCompletions": 40,
        "formattingProvider": "ormolu",
        "plugin": {
          "stan": { "globalOn": true }
        }
      }
    }
  }
}
  • You may also opt to use ghcup to easily install latest ghc, cabal and hls binaries to your PATH.
  • Check HLS README about global cabal configuration to enable documentation on hover.
  • Run haskell-language-server-wrapper generate-default-config in order to see an example for all configuration and default values.

With this you can avoid building anything from scratch and can start coding Haskell files right away.

Haxe

Install the coc-haxe plugin, then run :CocInstall coc-haxe.

Otherwise, you can use the language server that comes with VS Code, or manually build it yourself: see vshaxe/haxe-language-server, and then use the following json-settings.

{
    "languageserver": {
        "haxe": {
            "command": "node",
            "args": ["<path-to-server.js>"],
            "filetypes": ["haxe"],
            "trace.server": "verbose",
            "initializationOptions": {
                "displayArguments": ["build.hxml"]
            },
            "settings": {
                "haxe.executable": "haxe"
            }
        }
    }
}

Where <path-to-server.js> can either be a server.js you built from source or simply downloaded as part of the Haxe Visual Studio Code extension ("//.vscode/extensions/nadako.vshaxe-/bin/server.js").

Html

Use coc-html is recommended.

Java

Use coc-java is recommended.

Javascript/Typescript

Use coc-tsserver is recommended.

Json

use coc-json is recommended.

Julia

Using LanguageServer.jl

The LanguageServer, SymbolServer and StaticLint packages must be installed in Julia (1.x), i.e.

julia> using Pkg
julia> Pkg.add("LanguageServer")
julia> Pkg.add("SymbolServer")
julia> Pkg.add("StaticLint")

Install coc-julia, or register the server in coc-settings.json:

"languageserver": {
  "julia": {
    "command": "/usr/bin/julia",
    "args" : ["--startup-file=no", "--history-file=no", "-e",
    "using LanguageServer;\n       using Pkg;\n       import StaticLint;\n       import SymbolServer;\n       env_path = dirname(Pkg.Types.Context().env.project_file);\n       server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, \"\");\n       server.runlinter = true;\n       run(server);" ],
    "filetypes": ["julia"]
  }
}

Check out JuliaEditorSupport/LanguageServer.jl for more information.

In case you hit issue #836, the language server needs to be installed from master to avoid the problem:

julia> using Pkg
julia> Pkg.add(url="https://github.com/julia-vscode/LanguageServer.jl")
julia> Pkg.add("SymbolServer")
julia> Pkg.add("StaticLint")

Kotlin

Using kotlin-language-server

  1. Download server.zip from the releases page.
  2. Unzip the file in a convenient directory, for example inside ~/lsp/kotlin/.
"languageserver": {
  "kotlin": {
    "command": "~/lsp/kotlin/server/bin/kotlin-language-server",
    "filetypes": ["kotlin"]
  }
}

LaTeX

Using astoff/digestif

Make sure the digestif executable is available on your $PATH or use absolute path as command. Installation instructions can be found here.

"languageserver": {
  "digestif": {
    "command": "digestif",
    "filetypes": ["tex", "plaintex", "context"]
  }
}

For Texlab, use coc-texlab or:

"languageserver": {
  "latex": {
    "command": "/PATH/TO/texlab",
    "filetypes": ["tex", "bib", "plaintex", "context"]
  }
}

Lua

Using Alloyed/lua-lsp

"languageserver": {
  "lua": {
    "command": "lua-lsp",
    "filetypes": ["lua"]
  }
}

Using sumneko/lua-language-server. It's a little difficult to use sumneko/lua-language-server in coc.nvim directly, it's recommend to use coc-sumneko-lua that can download and setup for Lua. If you want to setup sumneko/lua-language-server in coc-settings.json, follow the steps: (tests on macOS, change the path if you're using Windows)

  1. install sumneko.lua in VSCode
  2. cd ~/.vscode/extensions/sumneko.lua-2.3.7
  3. chmod +x ./server/bin/macOS/lua-language-server, have no idea why this is needed, because in my VSCode extension, the server is not executable.
  4. setup in your coc-settings.json:
{
  "languageserver": {
    "lua": {
      "command": "~/.vscode/extensions/sumneko.lua-2.3.7/server/bin/macOS/lua-language-server",
      "args": ["-E", "~/.vscode/extensions/sumneko.lua-2.3.7/server/main.lua"],
      "rootPatterns": [".git"],
      "filetypes": ["lua"]
    }
  }
}

Using EmmyLua-LanguageServer

Make sure your Java environment variables are rights and change the path in the args field according to your installation.

"languageserver": {
  "lua": {
    "command": "java",
    "args": ["-cp", "/your/path/to/EmmyLua-LanguageServer/EmmyLua-LS/build/libs/EmmyLua-LS-all.jar", "com.tang.vscode.MainKt"],
    "filetypes": ["lua"],
    "rootPatterns": [".git/"]
  }
}

Markdown

Using coc-markdownlint, which has a codeAction support to autofix errs.

:CocInstall coc-markdownlint

Meson

Using mesonlsp

"languageserver": {
  "meson": {
    "command": "mesonlsp",
    "rootPatterns": ["meson.build", "meson_options.txt"],
    "args": ["--lsp"],
    "filetypes": ["meson"]
  }
}

Nim

Using nimlsp. Follow the instructions in the README of the repository. (Make sure that your Nimble bin directory is in your path)

"languageserver": {
  "nim": {
    "command": "nimlsp",
    "filetypes": ["nim"]
  }
}

Nix

Using nixd

"languageserver": {
  "nixd": {
    "command": "nixd",
    "rootPatterns": [".nixd.json"],
    "filetypes": ["nix"]
  }
}

Using rnix-lsp

"languageserver": {
  "nix": {
    "command": "rnix-lsp",
    "filetypes": ["nix"]
  }
}

OCaml and ReasonML

Using ocaml-language-server

"languageserver": {
    "ocaml": {
      "command": "ocaml-language-server",
      "args": ["--stdio"],
      "filetypes": ["ocaml", "reason"]
    }
}

If you installed merlin with opam

"languageserver": {
  "ocaml": {
    "command": "opam",
    "args": ["config", "exec", "--", "ocaml-language-server", "--stdio"],
    "filetypes": ["ocaml", "reason"]
  }
}

Using ocaml-lsp and opam

"languageserver": {
  "ocaml-lsp": {
    "command": "opam",
    "args": ["config", "exec", "--", "ocamllsp"],
    "filetypes": ["ocaml", "reason"]
  }
}

Using ocaml-lsp and esy

"languageserver": {
  "ocaml-lsp": {
    "command": "esy",
    "args": ["sh", "-c", "ocamllsp"],
    "filetypes": ["ocaml", "reason"]
  }
}

Using reason-language-server

"languageserver": {
  "reason": {
    "command": "reason-language-server",
    "filetypes": ["reason"]
  }
}

Perl

Use coc-perl is recommended.

PHP

Try marlonfan/coc-phpls or one of the following methods:

Using bmewburn/intelephense-docs

Recommended (way faster than php-language-server)

"languageserver": {
  "intelephense": {
    "command": "intelephense",
    "args": ["--stdio"],
    "filetypes": ["php"],
    "initializationOptions": {
      "storagePath": "/tmp/intelephense"
    }
  }
}

Using felixfbecker/php-language-server

"languageserver": {
  "phplang": {
    "command": "php",
    "args": ["/path/to/vendor/felixfbecker/language-server/bin/php-language-server.php"],
    "filetypes": ["php"]
  }
}

Note: make sure you can start the server by use command and args.

Via coc-psalm or

Using vimeo/psalm (psalm-language-server)

"languageserver": {
  "psalmls": {
    "command": "vendor/bin/psalm-language-server",
    "filetypes": ["php"],
    "rootPatterns": ["psalm.xml", "psalm.xml.dist"],
    "requireRootPattern": true
  }
}

PureScript

Using purescript-language-server (Configuration)

"languageserver": {
  "purescript": {
    "command": "purescript-language-server",
    "args": ["--stdio"],
    "filetypes": ["purescript"],
    "rootPatterns": ["bower.json", "psc-package.json", "spago.dhall"]
  }
}

Python

Use one of them below:

R

First install language server from R:

install.packages("languageserver")

Use coc-r-lsp extension.

If coc-r-lsp does not work properly, according to instructions from REditorSupport/languageserver, add below languageserver object to configuration file:

"languageserver": {
    "R": {
        "enable": true,
        "command": "/usr/bin/R",
        "args": [
            "--slave",
            "-e",
            "languageserver::run()"
        ],
        "filetypes": [
            "r"
        ]
    }
}

Robot Framework

  • install robotframework-lsp
  • Configure robot filetype detection in neovim configuration file autocmd BufNewFile,BufRead *.robot setlocal filetype=robot
"languageserver": {
    "robotframework_ls": {
        "command": "robotframework_ls",
        "filetypes": ["robot"],
        "settings": {
         // here the ls configuration
         }
    }
}

Racket

Using the racket-langserver

  • Install racket-langserver raco pkg install racket-langserver
  • Add the below snippet to your coc config
  "languageserver": {
    "racket": {
      "command": "racket",
      "args": [
        "-l",
        "racket-langserver"
      ],
      "filetypes": [
        "scheme", "rkt"
      ]
    }
  }

Rome

  • install coc-rome which uses rome
  • or try rome without an extension:
"languageserver": {
  "rome-lsp": {
    "command": "rome",
    "args": ["lsp"],
    "filetypes": [
      "javascript",
      "javascriptreact",
      "typescript",
      "typescriptreact",
      "json"
    ],
    "rootPatterns": [".config"],
    "requireRootPattern": true
  }
}

Ruby

Using coc-solargraph

Make sure solargraph is in your $PATH (sudo gem install solargraph) or use solargraph.commandPath to configure executable path of solargraph.

Using RuboCop:

"languageserver": {
  "rubocop": {
    "command": "rubocop",
    "args": ["--lsp"],
    "filetypes": ["ruby"]
  }
}

Using Sorbet:

"languageserver": {
  "sorbet": {
    "command": "srb",
    "args": ["tc", "--typed", "true", "--enable-all-experimental-lsp-features", "--lsp", "--disable-watchman"],
    "filetypes": ["ruby"],
    "rootPatterns": ["sorbet/config"],
    "initializationOptions": {},
    "settings": {}
  }
}

Using Steep:

"languageserver": {
  "steep": {
    "command": "steep",
    "args" : ["langserver"],
    "filetypes": ["ruby"]
  }
}

Using TypeProf:

"languageserver": {
  "typeprof": {
    "command": "typeprof",
    "args": ["--lsp", "--stdio"],
    "filetypes": ["ruby"]
  }
}
"languageserver": {
  "ruby-lsp": {
    "command": "ruby-lsp",
    "initializationOptions": {
      "experimentalFeaturesEnabled": false,
      "enabledFeatures": [
        "codeActions",
        "diagnostics",
        "documentHighlights",
        "documentLink",
        "documentSymbols",
        "foldingRanges",
        "formatting",
        "hover",
        "inlayHint",
        "onTypeFormatting",
        "selectionRanges",
        "semanticHighlighting",
        "completion"
      ],
      "formatter": "auto"
    },
    "filetypes": ["ruby"]
  }
}

Rust

"languageserver": {
  "rust": {
    "command": "rust-analyzer",
    "filetypes": ["rust"],
    "rootPatterns": ["Cargo.toml"]
  }
}

It's necessary to rustup component add rust-src and build rust-analyzer from sources, follow rust-analyzer User Manual.

For coc-rls do not add above configuration in coc-settings.json file just use ( rustup component add rls rust-analysis rust-src)

SQL

Using sql-language-server

"languageserver": {
  "sql": {
    "module": "/path/to/node_modules/sql-language-server/dist/bin/cli.js",
    "args": ["up", "--method", "node-ipc"],
    "filetypes": ["sql", "mysql"]
  }
}

The sdtio option is broken by it's console.log.

Scala

Using scalameta/metals:

Install coc-metals, which will automate the Metals installation and also provide extra helpers.

If you'd like to use Metals without the coc-metals extension, make sure the generated metals-vim binary is available on your $PATH and follow the instructions on the Metals Website.

"languageserver": {
  "metals": {
    "command": "metals-vim",
    "rootPatterns": ["build.sbt"],
    "filetypes": ["scala", "sbt"]
  }
}

Note that the Dotty Language server is no longer recommended. Instead, it is recommended to use Metals for Dotty/Scala 3.

Solidity

"languageserver": {
  "solidity": {
    "command": "/path/to/solc",
    "args": [ "--lsp" ],
    "rootPatterns": [".git/"],
    "filetypes": ["solidity"]
  }
}
  • or try the language server from vscode-solidity plugin. install the language server with npm install -g @juanfranblanco/vscode-solidity-server, then configure coc:
"languageserver": {
  "solidity": {
    "command": "vscode-solidity-server",
    "args": [ "--stdio" ],
    "rootPatterns": [".git/"],
    "filetypes": ["solidity"]
  }
}

SystemVerilog

Using svlangserver.

For installation, please check this section in the readme

Example settings file

{
    "languageserver": {
        "svlangserver": {
            "module": "/INSTALLATION/PATH/lib/svlangserver.js",
            "filetypes": ["systemverilog"],
            "settings": {
                "systemverilog.includeIndexing": ["**/*.{sv,svh}"],
                "systemverilog.excludeIndexing": ["test/**/*.sv*"],
                "systemverilog.defines" : [],
                "systemverilog.launchConfiguration": "/TOOL/PATH/verilator -sv -Wall --lint-only",
                "systemverilog.formatCommand": "/TOOL/PATH/verible-verilog-format"
            }
        }
    }
}

Systemd

Uses systemd-language-server.

Installation: pip install systemd-language-server

Settings file:

{
    "languageserver": {
        "systemd-language-server": {
          "command": "systemd-language-server",
          "filetypes": ["systemd"]
        }
    }
}

Terraform

Using Terraform-LSP. Build it and place it into any folder.

"languageserver": {
  "terraform": {
    "command": "terraform-lsp",
    "filetypes": ["terraform"],
    "initializationOptions": {}
  }
}

Using terraform-ls.

"languageserver": {
  "terraform": {
    "command": "terraform-ls",
    "args": ["serve"],
    "filetypes": ["terraform", "tf"],
    "initializationOptions": {}
  }
}

Typst

Using typst-lsp.

"languageserver": {
  "typst": {
    "command": "typst-lsp",
    "filetypes": ["typst"]
  }
}

V

Using vls. v ls --install to install it.

"languageserver": {
  "vlang": {
    "command": "v",
    "args": ["ls"],
    "rootPatterns": ["v.mod", ".git"],
    "filetypes": ["v", "vlang"],
  }
}

Vala

Using vala-language-server

"languageserver": {
  "vala": {
    "command": "vala-language-server",
    "filetypes": ["vala"],
  }
}

Vue

Using coc-vetur

:CocInstall coc-vetur

YANG

Using yang-lsp

Make sure yang-language-server is findable in your PATH variable, otherwise specify the full path to the yang-language-server executable

"languageserver": {
  "yls": {
    "command": "yang-language-server",
    "filetypes": ["yang"],
    "rootPatterns": ["yang.settings", ".git/"],
  }
}

Zig

Using coc-zig

:CocInstall coc-zig

Using zls

Make sure zls is findable in your PATH variable, otherwise specify the full path to the zls executable

"zig": {
  "command": "zls",
  "filetypes": [
    "zig"
  ]
},

vim/erb/markdown

Using efm-langserver

Location of efm-langserver config.yaml is:

  • UNIX: $HOME/.config/efm-langserver/config.yaml
  • Windows: %APPDATA%\efm-langserver\config.yaml

efm-langserver config:

languages:
  eruby:
    lint-command: 'erb -x -T - | ruby -c'
    lint-stdin: true
    lint-offset: 1
    format-command: 'htmlbeautifier'

  vim:
    lint-command: 'vint -'
    lint-stdin: true

  markdown:
    lint-command: 'markdownlint -s'
    lint-stdin: true
    lint-formats:
      - '%f:%l %m'
      - '%f:%l:%c %m'
      - '%f: %l: %m'

coc-settings.json:

"languageserver": {
  "efm": {
    "command": "efm-langserver",
    "args": [],
    // custom config path
    // "args": ["-c", "/path/to/your/config.yaml"],
    "filetypes": ["vim", "eruby", "markdown"]
  }
}