Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Auto configurations for Language Server for vim-lsp

License

NotificationsYou must be signed in to change notification settings

mattn/vim-lsp-settings

Repository files navigation

Actions StatusActions Status

Auto configurations for Language Servers forvim-lsp.

Introduction

Language Servers are not easy to install. Visual Studio Code provides easy ways to install and update Language Servers and Language Server Client. This plugin provides the same feature for Vim.

Installation

Using thevim-plug plugin manager:

Plug'prabirshrestha/vim-lsp'Plug'mattn/vim-lsp-settings'

You need to install bothvim-lsp and vim-lsp-settings.

Usage

While editing a file with a supported filetype:

:LspInstallServer

To uninstall server:

:LspUninstallServer server-name

Because there is no way to update a server, please run:LspInstallServer again, the newer version will be installed.

Auto-complete

If you want to use auto-completion, you can use one of the following.

asyncomplete.vim

Plug'prabirshrestha/asyncomplete.vim'Plug'prabirshrestha/asyncomplete-lsp.vim'

ddc.vim

Plug'Shougo/ddc.vim'Plug'shun/ddc-vim-lsp'

LSP server download directory

This is where LSP servers are placed on your system after you download them with:LspInstallServer

Windows

%LOCALAPPDATA%\vim-lsp-settings\servers

MacOS/Linux

$HOME/.local/share/vim-lsp-settings/servers

If you define$XDG_DATA_HOME:

$XDG_DATA_HOME/vim-lsp-settings/servers

You can change the directory to install servers by setg:lsp_settings_servers_dir option in full path.

Supported Languages

LanguageLanguage ServerInstallerLocal Install
Apex/VisualForceapex-jorje-lspYesYes
Astroastro-lsYesYes
AstrobiomeYesYes
Bashbash-language-serverYesYes
C#omnisharpYesYes
C/C++clangdYesYes
COBOLcobol-language-supportYesYes
CSScss-languageserverYesYes
CSStailwindcss-intellisenseYesYes
Clojureclojure-lspYesYes
Clojureclj-kondo-lspYesYes
Cmakecmake-language-serverYesYes
CrystalcrystallineYesYes
DdlsYesNo
Dserve-dYesNo
Dartanalysis-server-dart-snapshotYesYes
Dockerfiledockerfile-language-server-nodejsYesYes
Dotdot-language-serverYesYes
Elixirelixir-lsYesYes
Elmelm-language-serverYesYes
Erlangerlang-lsYesYes
F#fsautocompleteYesYes
F#fsharp-language-serverYesYes
Fennelfennel-lsYesYes
FortranfortlsYesYes
GogoplsYesYes
Gogolangci-lint-langserverYesYes
GraphQLgraphql-language-service-cliYesYes
GraphQLgql-language-serverYesYes
Groovygroovy-language-serverYesYes
Haskellhaskell-ide-engineNoNo
Haskellhaskell-language-serverNoNo
Helmhelm-lsYesYes
HTMLhtml-languageserverYesYes
HTMLangular-language-serverYesYes
HTMLtailwindcss-intellisenseYesYes
HyhyugaYesNo
JSONjson-languageserverYesYes
JSONromeYesYes
JSONbiomeYesYes
JSONpackage-version-serverYesYes
Jsonnetjsonnet-language-serverYesYes
Javaeclipse-jdt-lsYesYes
Javajava-language-serverNoYes
JavaScripttypescript-language-serverYesYes
JavaScriptvtslsYesYes
JavaScriptjavascript-typescript-stdioYesYes
JavaScriptromeYesYes
JavaScriptflowYesYes
JavaScripteslint-language-serverYesYes
JavaScriptbiomeYesYes
JuliaLanguageServer.jlYesNo
Kotlinkotlin-language-serverYesYes
Lispcl-lspYesNo
Luaemmylua-lsYesYes
Luasumneko-lua-language-serverYesYes
Markdown (remark)remark-language-serverYesYes
MarkdownMarksmanYesYes
Moonbitmoonbit-lspNoNo
NimnimlsNoNo
NixnixdYesYes
NixnilYesYes
PHPintelephenseYesYes
PHPpsalm-language-serverYesYes
OCamlocaml-lspUNIX OnlyYes
ProtobufbufYesYes
Puppetpuppet-languageserverYesYes
PureScriptpurescript-language-serverYesYes
Pythonpyls-all (pyls with dependencies)YesYes
Pythonpyls (pyls without dependencies)YesYes
Pythonpyls-ms (Microsoft Version)YesYes
Pythonjedi-language-serverYesYes
Pythonpyright-langserverYesYes
Pythonpylsp-all (pylsp with dependencies)YesYes
Pythonpylsp (pylsp without dependencies)YesYes
PythonpylyzerYesYes
PythonruffYesYes
Pythonruff-lspYesYes
PythontyYesYes
PythonzubanYesYes
Pythonbasedpyright-langserverYesYes
Prismaprisma-language-serverYesYes
QmlqmllsYesYes
RlanguageserverYesNo
Racketracket-lspYesNo
Reasonreason-language-serverYesYes
Rubyruby-lspUNIX OnlyYes
RubysolargraphYesYes
RubysteepYesYes
RubytypeprofYesYes
Rubyrubocop (lsp mode)YesNo
RubysorbetYesNo
RustrlsYesNo
Rustrust-analyzerYesYes
Rustbacon-lsYesYes
SphinxesbonioYesYes
SQLsql-language-serverYesYes
SQLsqlsYesYes
SQLplpgsql-serverUNIX OnlyYes
StarlarkstarplsYesYes
ScalaMetalsYesYes
Sveltesvelte-language-serverYesYes
Sveltetailwindcss-intellisenseYesYes
SveltebiomeYesYes
Swiftsourcekit-lspYesNo
systemdsystemd-lspUNIX OnlyYes
SystemVerilogverible-verilog-lsUNIX OnlyYes
SystemVerilogsvlsYesYes
TeXtexlabYesYes
TeXdigestifYesNo
Terraformterraform-lspYesYes
Terraformterraform-lsYesYes
TOMLtaplo-lspNoYes
TTCN-3nttYesYes
TypeScripttypescript-language-serverYesYes
TypeScriptvtslsYesYes
TypeScriptdenoYesYes
TypeScriptromeYesYes
TypeScripteslint-language-serverYesYes
TypeScriptbiomeYesYes
Typsttypst-lspYesYes
TypsttinymistYesYes
Vimvim-language-serverYesYes
Valavala-language-serverNoNo
Verilogverible-verilog-lsUNIX OnlyYes
Verylveryl-lsYesYes
Vuevolar-server (Vue Language Tools)YesYes
VuevlsYesYes
VuebiomeYesYes
Vv-analyzerYesYes
Vvlang-vlsYesYes
XMLlemminxYesYes
YAMLyaml-language-serverYesYes
YAMLaws-lsp-yamlYesYes
YANGyang-lspYesYes
ZIGzlsYesYes
*efm-langserverYesYes
*typos-lspYesYes
*copilot-language-serverYesYes
*mozuku-lspYesYes

Notes

clangd (C/C++)

There is a Linux OS/version that does not run the locally installedclangd due to zlib version mismatch. If you want to useclangd, please installclangd on your system.

rls (Rust)

If you installedrls already, you can userls without configurations. But if you have not installedrls yet, you can install it by followingthese instructions.

If you want to configure many of therust-analyzer configurationoptions, you needto you insert ainitialization_options dictionary betweenrust-analyzer andsubdictionaries (cargo,completion,procMacro, etc.) in your.vim-lsp-settings/settings.json.

{"rust-analyzer": {"initialization_options": {"server.extraEnv": {"RUSTUP_TOOLCHAIN":"nightly"            },"cargo": {"target":"aarch64-apple-ios-sim"            },"completion": {"autoimport": {"enable":false } },"procMacro": {"enable":true }        }    }}
Extension NameStatus
initializationOptions
Snippet TextEdit
CodeAction Groups
Parent Module
Join Lines✔️
On Enter
Structural Search Replace (SSR)
Matching Brace✔️
Runnables
Test explorer
Open External Documentation✔️
Analyzer Status✔️
Reload Workspace✔️
Rebuild proc-macros
Unindexed Project
Server Status
Syntax Tree
View Hir
View Mir
Interpret Function
View File Text
View ItemTree
View Crate Graph
Shuffle Crate Graph
Expand Macro✔️
Hover Actions
Open Cargo.toml✔️
Related tests
Hover Range
Move Item
Workspace Symbols Filtering
Client Commands
Colored Diagnostic Output
Dependency Tree
View Recursive Memory Layout

bacon-ls (Rust)

Thebacon command is required. If not exists, it will be installed globally.

bacon-ls is not a replacement forrust-analyzer, they can be used together. The workspace folders feature is required. Therefore, the following configuration is necessary:

letg:lsp_experimental_workspace_folders=1letg:lsp_settings_filetype_rust= ['rust-analyzer','bacon-ls']letg:lsp_settings= {\'rust-analyzer': {\'initialization_options': {\'checkOnSave':v:false,\'diagnostics':v:false,\  },\}

For detailed configuration options, please refer to thebacon-ls configuration documentation.

deno (TypeScript)

To use deno,deno.json(c) should located on the project directory or traversing the filesystem upwards.

Ifdeno.json does not located,node_modules shouldnot located on the project directory or traversing the filesystem upwards.

When editing Node projects, the following warning message is shown.

server "deno" is disabled since "node_modules" is found

If you want to disable warning message, you may put.vim-lsp-settings/settings.json in your project root directory.

{"deno": {"disabled":true  }}

To use importMap, default file name isimport_map.json.

If you don't want to useimport_map.json, you may put.vim-lsp-settings/settings.json in your project root directory and set importMap whatever you want.

{  "deno": {    "initialization_options": {      "enable": true,      "lint": true,      "unstable": true,      "importMap": "your_own_import_map.json"    }  }}

Recommend to addlet g:markdown_fenced_languages = ['ts=typescript'] to yourvimrc for hover(preview) Deno's library.

Note thatdeno language server is specified.

letg:lsp_settings_filetype_typescript= ['typescript-language-server','eslint-language-server','deno']

flow (JavaScript)

To use flow, the.flowconfig has to be located on the top of project directory.

graphql-language-service-cli(GraphQL)

To use graphql-language-service-cli, theGraphQL Config has to be located on the top of project directory. The schema must be pointed to the schema file correctly.

{"schema":"./schema.graphql"}

gql-language-server (GraphQL)

To use gql-language-server, the.gqlconfig has to be located on the top of project directory. The schema must be pointed to the schema file correctly.

{schema:{files:'path/to/schema.graphql'}}

Finally, you have to install@playlyfe/gql into your project.

$ npm install @playlyfe/gql --save-dev

If you have a separate existing installation of the dart analysis server andwant it to be used, it must either exist in your path, or you must specify itslocation. See 'Configurations' below.

If you installedhie with stack, you can use hie without configurations.But if you have not installedhie yet, you can install it by followingthese steps.

To use older versiongolangci-lint, please run:LspSettingsGlobalEdit and put bellow configuration.

"golangci-lint-langserver":{"initialization_options":{"command":["golangci-lint","run","--enable-all","--disable","lll","--out-format","json"]}}

To resolve issue about proper '-jvm-target' (INLINE_FROM_HIGHER_PLATFORM)readmore

letg:lsp_settings= {\'kotlin-language-server': {\'workspace_config': {\'kotlin': {'compiler': {'jvm': {'target':'17'}}}\   }\ }\}

To use the language server you need a .qmlls.ini, which can be generatedautomatically. Additionally, you have to configure your the qml includedirectories from the qt install root.

letg:lsp_settings= {\'qmlls': {\'args': ['-I','[QTROOT]/qml'],\ },\} By default, the qmlls server willsearch the QML_IMPORT PATH (-Eoption).

To use rubocop-lsp-mode, you need to install rubocop in your Ruby project using bundler.

To use sorbet, you need to install rubocop in your Ruby project using bundler.Also,Watchman is required to watch file changes.For more details, please seeSorbet andWatchman documentations.

Vue Language Tools v3 works only withvtsls, which is another TypeScript Language Server implementation.So, you need to install bothvtsls andvolar-server and specify them to be used with the following code:

letg:lsp_settings_filetype_vue= ['vtsls','volar-server']letg:lsp_settings_filetype_typescript= ['vtsls']

Extra Configurations

Most of the configurations are not required.

If you installedclangd already, you can useclangd for C/C++ without any configuration. But if you installedclang with the name clangd-6.0, you can replace executable with the following config:

letg:lsp_settings= {\'clangd': {'cmd': ['clangd-6.0']},\'efm-langserver': {'disabled':v:false}\}

Or put.vim-lsp-settings/settings.json in your project root directory.

{"clangd": {"cmd": ["clangd-6.0"]  },"efm-langserver": {"disabled":false  }}

If you already have the dart analysis server installed but it is not in yourpath, you can still configure the settings to use it. Use the vimscript belowto change the command to start the server. Note the command has two parts:the path to your 'dart' executable, and a subcommand 'language-server.

letg:lsp_settings= {\'analysis-server-dart-snapshot': {\'cmd': [\'/path/to/your/dart-sdk/bin/dart',\'language-server'\    ],\},\}

To edit the project localsettings.json, do:LspSettingsLocalEdit.

Overridable keys are:

  • cmd (List ex:['clangd-6.0', '-enable-snippets'])
  • initialization_options (Dictionary)
  • allowlist (List)
  • blocklist (List)
  • config (Dictionary)
  • workspace_config (Dictionary)
  • disabled (Boolean)
  • root_uri (String)
  • root_uri_patterns (List)
  • semantic_highlight (Dictionary)

If you have some Language Servers and want to use specified the server:

letg:lsp_settings_filetype_perl='slp'letg:lsp_settings_filetype_html= ['html-languageserver','angular-language-server']letg:lsp_settings_filetype_typescript= ['typescript-language-server','eslint-language-server']

When the servers are specified in a list, these will all be started.

If you want to configure Language Server to useflake8 rather thanpycodestyle,the following can be added to your~/.vimrc file.Note thatpylsp-all was the automatically registered server name. Check with:LspStatus.

letg:lsp_settings= {\'pylsp-all': {\'workspace_config': {\'pylsp': {\'configurationSources': ['flake8']\      }\    }\  },\}

If you want to disable a Language Server:

letg:lsp_settings= {\'perl-languageserver': {\'disabled':1,\  }\}

When resolving the root directory for a language server, this plugin will lookfor directories containing special root markers defined ing:lsp_settings_root_markers.

By default, this is set to:

letg:lsp_settings_root_markers= [\'.git',\'.git/',\'.svn',\'.hg',\'.bzr'\]

If you need to specify alternative root markers:

letg:lsp_settings_root_markers= ['.projections.json','.git','.git/']

This would look for a custom.projections.json, a git submodule.git or a git root.git/ starting from the current directory upwards.

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

About

Auto configurations for Language Server for vim-lsp

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors185


[8]ページ先頭

©2009-2025 Movatter.jp