Skip to content
Cauryl edited this page Aug 28, 2020 · 19 revisions

Dart - Dart Analysis Server

The Dart and Flutter SDK ships with an analysis server with a --lsp flag. Install the vim-lsc-dart plugin to configure this client automatically.

C/C++ - using Clang

  • bash setup
 git clone https://github.com/cquery-project/cquery.git --recursive
 cd cquery && mkdir build && cd build
 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/.local \
          -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
 make -j8 && make install
  • vimrc
let g:lsc_server_commands = {
  \ 'c': 'cquery --init="{\"cacheDirectory\": \"/tmp/cquery_cache\"}"',
  \ 'cpp': 'cquery --init="{\"cacheDirectory\": \"/tmp/cquery_cache\"}"',
  \ }

Python

  • bash setup
pip install 'python-language-server[all]'
  • vimrc
let g:lsc_server_commands = { 'python' : 'pyls'}

Elixir - JakeBecker/ElixirLS

First, clone ElixirLS into a directory of your choosing:

git clone https://github.com/JakeBecker/elixir-ls.git

Then run:

mix compile; mix elixir_ls.release -o <output_directory>

Make sure <output_directory>/language_server.sh is executable.

Add the following to your .bash_profile:

  • bash_profile
function elixir-language-server() {
  (<output_directory>/language_server.sh $*)
}
  • vimrc
let g:lsc_server_commands = {
  \ 'elixir': 'elixir-language-server'
  \ }

Scala

You can find instructions on how to bootstrap Metals for vim-lsc here on the Metals website

You'll want to make sure that you correctly have the --java-opt -Dmetals.client=vim-lsc set correctly to vim-lsc. Then you can include the following in your .vimrc.

let g:lsc_server_commands = {
  \ 'scala': 'metals-vim'
  \ }

JavaScript

typescript-language-server

npm install -g typescript typescript-language-server
  • vimrc
let g:lsc_server_commands = {
  \ 'javascript': 'typescript-language-server --stdio'
  \ }

javascript-typescript-langserver

npm install -g javascript-typescript-langserver
  • vimrc
let g:lsc_server_commands = {
  \ 'javascript': 'javascript-typescript-stdio'
  \ }

PHP

npm install -g intelephense
  • vimrc
let g:lsc_server_commands = {
  \ 'php': {
  \    'command': 'intelephense --stdio',
  \    'message_hooks': {
  \        'initialize': {
  \            'initializationOptions': {'storagePath': '/tmp/intelephense'},
  \        },
  \    },
  \  },
  \}

HTML

npm install -g vscode-html-languageserver-bin
  • vimrc
let g:lsc_server_commands = {
  \ 'html': 'html-languageserver --stdio'
  \ }

CSS

npm install -g vscode-css-languageserver-bin
  • vimrc
let g:lsc_server_commands = {
  \ 'css': 'css-languageserver --stdio'
  \ }

Golang - gopls

Set $GOPATH and ensure $PATH includes $GOPATH/bin

go get golang.org/x/tools/gopls@latest

Please use the official gopls settings found here

Vim

npm install -g vim-language-server
let g:lsc_server_commands = {
  \ 'vim' : {
  \   'name': 'vim-language-server',
  \   'command': 'vim-language-server --stdio',
  \      'message_hooks': {
  \          'initialize': {
  \              'initializationOptions': { 'vimruntime': $VIMRUNTIME, 'runtimepath': &rtp },
  \          },
  \      },
  \   },
  \}

Other

If all you want is linting you can use efm-languageserver. efm-languageserver is a general purpose languageserver used like vim's compiler plugins and errorformat settings. For more information consult their documentation here

Set $GOPATH and ensure $PATH includes $GOPATH/bin

go get github.com/mattn/efm-langserver
let g:lsc_server_commands = {
  \ 'mail' : {
  \   'name': 'efm-langserver',
  \   'command': 'efm-langserver -c=path/to/config.yaml',
  \   'suppress_stderr': v:true,
  \  },
  \}

Bash/sh

npm install -g bash-language-server
  • vimrc
let g:lsc_server_commands = {
  \ 'sh': 'bash-language-server start'
  \ }
Clone this wiki locally