Skip to content

How to install servers

Daniel S Poulin edited this page Sep 16, 2019 · 29 revisions

This is a short reference for installation of language servers listed in default kak-lsp.toml configuration.

Rust

rustup component add rls-preview rust-analysis rust-src

Crystal

Installation

git clone https://github.com/crystal-lang-tools/scry
cd scry
shards build
ln -s $PWD/bin/scry ~/.local/bin

Configuration

~/.config/kak-lsp/kak-lsp.toml

[language.crystal]
filetypes = ["crystal"]
roots = ["shard.yml"]
command = "scry"

C, C++

See https://github.com/cquery-project/cquery/wiki/Getting-started

kak-lsp supports semantic highlighting using cquery.

If you prefer ccls, change language.c_cpp section in kak-lsp to something like this:

[language.c_cpp]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".ccls", ".git"]
command = "ccls"

and refer https://github.com/MaskRay/ccls/wiki/Getting-started for installing and configuring ccls itself.

kak-lspsupports nearly all ccls lsp extensions, including semantic highlighting, navigations, and special cross references. See the ccls-{navigate,vars,inheritance,member,call} kak functions for a reference. They are also described in the ccls wiki.

JavaScript + Flow

npm install -g flow-bin

Typescript

npm install -g typescript
npm install -g typescript-language-server
[language.typescript]
filetypes = ["typescript"]
roots = ["package.json"]
command = "typescript-language-server"
args = ["--stdio"]

or alternatively Sourcegraphs implementation:

npm install -g typescript
npm install -g javascript-typescript-langserver

[language.typescript]
filetypes = ["typescript"]
roots = ["package.json", "tsconfig.json"]
command = "javascript-typescript-stdio"

HTML, CSS, JSON

npm install -g vscode-{html,css,json}-languageserver-bin

OCaml, ReasonML

npm install -g ocaml-language-server

Haskell

See https://github.com/haskell/haskell-ide-engine#installation

Python

pip install 'python-language-server[all]'

python-language-server does not currently use initialization options python-language-server#403, so you can not configure it via kak-lsp.toml. Instead, use the lsp_server_configuration option in your kakrc:

set-option global lsp_server_configuration pyls.configurationSources=["flake8"]

Go

By default kak-lsp uses bingo language server, which supports Go modules.

See https://github.com/saibing/bingo#install for installation instructions.

If you prefer using go-langserver, install it with

go get -u github.com/sourcegraph/go-langserver

and then use the following config in your kak-lsp.toml:

[language.go]
filetypes = ["go"]
roots = ["Gopkg.toml", "go.mod", ".git", ".hg"]
command = "go-langserver"
args = ["-mode", "stdio", "-gocodecompletion"]

PHP (Intelephense)

Install the server component globally using npm:

npm i -g intelephense

Then in kak-lsp.toml add the following, where <path-to-intelephense> is the output of which intelephense:

[language.php]
filetypes = ["php"]
roots = ["composer.json"]
command = "node"
args = ["<path-to-intelephense>"]

PHP (PHP Language Server)

Install globally according to the installation instructions. For ArchLinux you may install through the AUR: https://aur.archlinux.org/packages/php-language-server/

Then in kak-lsp.toml add

[language.php]
filetypes = ["php"]
roots = ["composer.json"]
command = "php"
args = ["path/to/php-language-server.php"]

Where you change path/to/php-language-server.php to the path to the php-language-server.php file. You can use composer g show felixfbecker/language-server to get the path to the global installation, then append bin/php-language-server.php to get the path.

PHP (Psalm)

Install it to your project according to the installation instructions. Once installed, you can configure your kak-lsp.toml as follows:

[language.php]
filetypes = ["php"]
roots     = ["composer.json"]
command   = "php"
args      = ["vendor/bin/psalm-language-server"]

Despite not being an absolute path, this will still work as the context of execution of the php command is where your composer.json file is.

Bash

npm i -g bash-language-server

Dart

See https://github.com/natebosch/dart_language_server#installing

pub global activate dart_language_server

D

Install the D Language Server by running dub fetch dls, then dub run dls:bootstrap. The second command will print the location where dub installed the server. You will need to place this executable on your path, e.g. by making the path absolute (dub will likely print a relative path) and creating a symlink sudo ln -s <absolute path to dls> /usr/local/bin/dls.

Nim

nimble install nimlsp

[language.nim]
filetypes = ["nim"]
roots = ["*.nimble", ".git"]
command = "nimlsp"
args = ["path/to/nim/installation"] # optional (if installed from nimble or path wasn't provided at compiletime)

Elm

You may be able to install the elm-language-server with npm:

`npm install -g elm-language-server'

If this doesn't work, or to install the latest version of the elm-language-server, clone the repo and compile it:

git clone git@github.com:elm-tooling/elm-language-server.git
cd elm-language-server
npm install
npm run compile
npm link

Then, you should be able to run the language server with the following command:

elm-language-server --stdio

Installation of elm-test and elm-format is normally done with npm:

npm install -g elm-test
npm install -g elm-format
You can’t perform that action at this time.