-
Notifications
You must be signed in to change notification settings - Fork 61
Home
Language Server Specific Configuration
Information about using various language servers with the LSP plugin is below. A sample VimScript code snippet is given for each language server to register the server with the LSP plugin. A sample absolute path to the language server executable is used in these examples. You may need to modify the path to match where the language server is installed in your system. In some cases, it may be simpler to add the language server path to the PATH environment variable.
Language: HTML
Home Page: https://github.com/angular/vscode-ng-language-service
Sample code to add the bash language server to the LSP plugin:
call LspAddServer([#{name: 'angular',
\ filetype: 'html',
\ path: '/usr/local/bin/ngserver.cmd',
\ args: ['--stdio', '--ngProbeLocations', '/usr/local/bin/@angular/language-service', '--tsProbeLocations', '/usr/local/bin/typescript']
\ }])
Command to install the angular language server on Linux:
npm install -g @angular/language-server @angular/language-service typescript
Language: Bash shell scripts
Home Page: https://github.com/bash-lsp/bash-language-server
Sample code to add the bash language server to the LSP plugin:
" Bash
call LspAddServer([#{name: 'bashls',
\ filetype: 'sh',
\ path: '/usr/local/bin/bash-language-server',
\ args: ['start']
\ }])
Language: C/C++
Home Page: https://clangd.llvm.org/
Sample code to add the clangd language server to the LSP plugin:
call LspAddServer([#{name: 'clangd',
\ filetype: ['c', 'cpp'],
\ path: '/usr/local/bin/clangd',
\ args: ['--background-index', '--clang-tidy']
\ }])
Language: CSS
Home Page: https://github.com/vscode-langservers/vscode-css-languageserver-bin
Sample code to add the CSS language server to the LSP plugin:
call LspAddServer([#{name: 'cssls',
\ filetype: 'css',
\ path: '/usr/local/node_modules/.bin/css-languageserver',
\ args: ['--stdio'],
\ }])
Note: The CSS language server supports code completion only if the snippetSupport option is enabled.
Language: Dart
Home Page: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md
Sample code to add the dart language server to the LSP plugin:
call LspAddServer([#{name: 'dart',
\ filetype: ['dart'],
\ path: '/usr/lib/dart/bin/dart',
\ args: ['language-server', '--client-id', 'vim']
\ }])
Language: Typescript/Javascript
Home Page: https://deno.land
Sample code to add the deno language server to the LSP plugin:
call LspAddServer([#{name: 'deno',
\ filetype: ['javascript', 'typescript'],
\ path: '/usr/local/bin/deno',
\ args: ['lsp'],
\ debug: v:true,
\ initializationOptions: #{
\ enable: v:true,
\ lint: v:true
\ }
\ }])
Language: Java
Home Page: https://github.com/eclipse/eclipse.jdt.ls
Sample code to add the jdtls language server to the LSP plugin:
call LspAddServer([#{name: 'jdtls',
\ filetype: 'java',
\ path: '/usr/local/jdtls/bin/jdtls',
\ args: []
\ initializationOptions: {
\ settings: {
\ java: {
\ completion: {
\ filteredTypes: ["com.sun.*", "java.awt.*", "jdk.*", "org.graalvm.*", "sun.*", "javax.awt.*", "javax.swing.*"],
\ },
\ },
\ },
\ },
\ }])
The Eclipse Java language server wiki page has more information about the jdtls language server initialization options.
Language: General Purpose Language Server
Home Page: https://github.com/mattn/efm-langserver
Sample code to add the efm language server to the LSP plugin:
call LspAddServer([#{name: 'efm-langserver',
\ filetype: ['javascript', 'typescript'],
\ path: '/usr/local/bin/efm-langserver',
\ args: []
\ initializationOptions: #{
\ documentFormatting: v:true
\ },
\ workspaceConfig: #{
\ languages: #{
\ javascript: [
\ #{
\ lintCommand: "eslint -f unix --stdin --stdin-filename ${INPUT}",
\ lintStdin: true,
\ lintFormats: ["%f:%l:%c: %m"],
\ formatCommand: "eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
\ formatStdin: v:true
\ }
\ ],
\ typescript: [
\ #{
\ lintCommand: "eslint -f unix --stdin --stdin-filename ${INPUT}",
\ lintStdin: v:true,
\ lintFormats: ["%f:%l:%c: %m"],
\ formatCommand: "eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
\ formatStdin: v:true
\ }
\ ]
\ }
\ }
\ }])
Language: Fortran
Home Page: https://github.com/hansec/fortran-language-server
Sample code to add the fortran language server to the LSP plugin:
call LspAddServer([#{name: 'fortls',
\ filetype: 'fortran',
\ path: '/usr/local/bin/fortls',
\ args: ['--use_signature_help', '--hover_signature']
\ }])
Language: Go
Home Page: https://github.com/golang/tools/tree/master/gopls
Sample code to add the gopls language server to the LSP plugin:
call LspAddServer([#{name: 'gopls',
\ filetype: 'go',
\ path: '/usr/local/bin/gopls',
\ args: ['serve']
\ }])
Language: html
Home Page: https://github.com/vscode-langservers/vscode-html-languageserver-bin
Sample code to add the HTML language server to the LSP plugin:
call LspAddServer([#{name: 'htmlls',
\ filetype: 'html',
\ path: '/usr/local/node_modules/.bin/html-languageserver',
\ args: ['--stdio'],
\ }])
Note: The HTML language server supports code completion only if the snippetSupport option is enabled.
Language: Lua
Home Page: https://github.com/LuaLS/lua-language-server
Sample code to add the luals language server to the LSP plugin:
call LspAddServer([#{name: 'luals',
\ filetype: 'lua',
\ path: '/usr/local/luals/bin/lua-language-server',
\ args: [],
\ }])
Language: C#
Home Page: https://github.com/OmniSharp/omnisharp-roslyn
Sample code to add the omnisharp language server to the LSP plugin:
call LspAddServer([#{name: 'omnisharp',
\ filetype: 'cs',
\ path: expand('$HOME/omnisharp/omnisharp.exe'),
\ args: ['--z', '--languageserver', '--encoding', 'utf-8'],
\ }])
Language: Perl
Home Page: https://github.com/bscan/PerlNavigator
Sample code to add the Perl Navigator language server to the LSP plugin:
call LspAddServer([#{name: 'perlnavigator',
\ filetype: ['perl'],
\ path: '/usr/bin/node',
\ args: ['/usr/local/PerlNavigator/server/out/server.js', '--stdio']
\ }])
Language: PHP
Home Page: https://github.com/bmewburn/vscode-intelephense
Sample code to add the intelephense language server to the LSP plugin:
call LspAddServer([#{name: 'intelephense',
\ filetype: ['php'],
\ path: '/usr/local/bin/intelephense',
\ args: ['--stdio']
\ }])
Language: Python
Home Page: https://github.com/python-lsp/python-lsp-server
Sample code to add the pylsp language server to the LSP plugin:
call LspAddServer([#{name: 'pylsp',
\ filetype: 'python',
\ path: '/usr/local/bin/pylsp',
\ args: []
\ }])
Language: Python
Home Page: https://github.com/microsoft/pyright
Sample code to add the pyright language server to the LSP plugin:
call LspAddServer([#{name: 'pyright',
\ filetype: 'python',
\ path: '/usr/local/node_modules/.bin/pyright-langserver',
\ args: ['--stdio'],
\ workspaceConfig: #{
\ python: #{
\ pythonPath: '/usr/bin/python3.10'
\ }}
\ }])
Command to install the pyright language server on Linux:
$ npm install -g pyright
Language: Rust
Home Page: https://rust-analyzer.github.io/
Sample code to add the rust-analyzer language server to the LSP plugin:
call LspAddServer([#{name: 'rustanalyzer',
\ filetype: ['rust'],
\ path: '/usr/local/bin/rust-analyzer-x86_64-unknown-linux-gnu',
\ args: [],
\ syncInit: v:true
\ }])
Language: Ruby
Home Page: https://solargraph.org/
Sample code to add the Solargraph language server to the LSP plugin:
call LspAddServer([#{name: 'solargraph'
\ filetype: ['ruby'],
\ path: 'solargraph',
\ args: ['stdio']
\ }])
Language: Typescript/JavaScript
Home Page: https://github.com/typescript-language-server/typescript-language-server
Sample code to add the typescript language server to the LSP plugin:
call LspAddServer([#{name: 'tsserver'
\ filetype: ['javascript', 'typescript'],
\ path: '/usr/local/bin/typescript-language-server',
\ args: ['stdio']
\ }])
Language: Vimscript
Home Page: https://github.com/iamcco/vim-language-server
Sample code to add the Vimscript language server to the LSP plugin:
call LspAddServer([#{name: 'vimls',
\ filetype: 'vim',
\ path: '/usr/local/bin/vim-language-server',
\ args: ['--stdio']
\ }])
Language: Vue
Home Page: https://github.com/vuejs/language-tools
Sample code to add the Volar language server to the LSP plugin:
call LspAddServer([#{name: 'volar-server',
\ filetype: ['vue', 'typescript'],
\ path: '/usr/local/node_modules/.bin/volar-server',
\ args: ['--stdio'],
\ initializationOptions: #{
\ typescript: #{
\ tsdk: '/usr/local/node_modules/typescript/lib'
\ }
\ }
\ }])