-
Notifications
You must be signed in to change notification settings - Fork 87
Language Servers
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.
clangd comes with the clang package on most Linux distributions. On macOS you need to install the llvm package from Homebrew and look in
/usr/local/opt/llvm/bin for the clangd binary.
vimrc:
let g:lsc_server_commands = {
\ 'cpp': {
\ 'command': 'clangd --background-index',
\ 'suppress_stderr': v:true
\},
\ 'c': {
\ 'command': 'clangd --background-index',
\ 'suppress_stderr': v:true
\},
\}- bash setup
pip install 'python-language-server[all]'- vimrc
let g:lsc_server_commands = { 'python' : 'pylsp'}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'
\ }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'
\ }npm install -g typescript typescript-language-server- vimrc
let g:lsc_server_commands = {
\ 'javascript': 'typescript-language-server --stdio'
\ }npm install -g javascript-typescript-langserver- vimrc
let g:lsc_server_commands = {
\ 'javascript': 'javascript-typescript-stdio'
\ }npm install -g intelephense- vimrc
let g:lsc_server_commands = {
\ 'php': {
\ 'command': 'intelephense --stdio',
\ 'message_hooks': {
\ 'initialize': {
\ 'initializationOptions': {'storagePath': '/tmp/intelephense'},
\ },
\ },
\ },
\}npm install -g vscode-html-languageserver-bin- vimrc
let g:lsc_server_commands = {
\ 'html': 'html-languageserver --stdio'
\ }npm install -g vscode-css-languageserver-bin- vimrc
let g:lsc_server_commands = {
\ 'css': 'css-languageserver --stdio'
\ }Set $GOPATH and ensure $PATH includes $GOPATH/bin
go get golang.org/x/tools/gopls@latestPlease use the official gopls settings found here
npm install -g vim-language-serverlet g:lsc_server_commands = {
\ 'vim' : {
\ 'name': 'vim-language-server',
\ 'command': 'vim-language-server --stdio',
\ 'message_hooks': {
\ 'initialize': {
\ 'initializationOptions': { 'vimruntime': $VIMRUNTIME, 'runtimepath': &rtp },
\ },
\ },
\ },
\}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-langserverlet g:lsc_server_commands = {
\ 'mail' : {
\ 'name': 'efm-langserver',
\ 'command': 'efm-langserver -c=path/to/config.yaml',
\ 'suppress_stderr': v:true,
\ },
\}npm install -g bash-language-server- vimrc
let g:lsc_server_commands = {
\ 'sh': 'bash-language-server start'
\ }- Install Eclipse JDT Language Server
- Create a executable script (jdt_language_server) with the content below and make sure it is in your $PATH
#/usr/bin/env sh
JDTLS=<path-to-jdt.ls-folder>
java -Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product \
-Dlog.protocol=true \
-Dlog.level=ALL \
-noverify \
-Xmx1G \
-jar $JDTLS/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_<version>.jar \
-configuration $JDTLS/org.eclipse.jdt.ls.product/target/repository/config_linux \
--add-modules=ALL-SYSTEM \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
"$@"- vimrc
let g:lsc_server_commands = {
\ 'java': 'jdt_language_server -data ' . getcwd()
\ }Install the rust-analyzer either through binary installation or with rustup as mentioned in the docs. Here is the simpler binary installation for linux:
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ~/.local/bin/rust-analyzer
chmod +x ~/.local/bin/rust-analyzerIf using this method, ensure ~/.local/bin is listed in the $PATH variable.
For other platforms, download the latest release binary and make similar changes.
- vimrc
let g:lsc_server_commands = {
\ "rust": "rust-analyzer",
\ }
sudo bash < <(curl -s https://raw.githubusercontent.com/clojure-lsp/clojure-lsp/master/install)- vimrc
let g:lsc_server_commands = {
\ 'clojure': 'clojure-lsp',
\ }