diff options
-rw-r--r-- | plugin/lsp_settings.vim | 28 | ||||
-rw-r--r-- | settings.json | 57 |
2 files changed, 84 insertions, 1 deletions
diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim index c90b039..cf368be 100644 --- a/plugin/lsp_settings.vim +++ b/plugin/lsp_settings.vim @@ -123,7 +123,7 @@ function! s:vimlsp_settings_suggest() abort if exists(':LspInstallServer') !=# 2 redraw echohl Directory - echomsg 'If you want to enable Language Server, please do :LspInstallServer' + echomsg 'If enable Language Server, please do :LspInstallServer' echohl None command! -buffer LspInstallServer call s:vimlsp_install_server() endif @@ -155,6 +155,32 @@ function! s:vimlsp_setting() abort exe 'autocmd FileType' l:ft 'call s:vimlsp_load_or_suggest(' string(l:ft) ')' augroup END endfor + augroup vimlsp_suggest + au! + autocmd BufNewFile,BufRead * call s:vimlsp_suggest_plugin() + augroup END +endfunction + +function! s:vimlsp_suggest_plugin() abort + if &ft != '' + return + endif + let l:ext = expand('%:e') + for l:ft in keys(s:settings) + for l:server in s:settings[l:ft] + if !has_key(l:server, 'vim-plugin') + continue + endif + if index(l:server['vim-plugin']['extensions'], l:ext) == -1 + continue + endif + redraw + echohl Directory + echomsg printf('If enable Language Server, please install vim-plugin "%s"', l:server['vim-plugin']['name']) + echohl None + return + endfor + endfor endfunction function! s:vimlsp_load_or_suggest(ft) abort diff --git a/settings.json b/settings.json index cc5d78f..61d9e49 100644 --- a/settings.json +++ b/settings.json @@ -66,6 +66,13 @@ "elixir": [ { "command": "elixir-ls", + "vim-plugin": { + "name": "elixir-editors/vim-elixir", + "extensions": [ + "ex", + "exs" + ] + }, "requires": [ "elixir" ] @@ -74,6 +81,12 @@ "elm": [ { "command": "elm-language-server", + "vim-plugin": { + "name": "ElmCast/elm-vim", + "extensions": [ + "elm" + ] + }, "requires": [ "npm" ] @@ -82,6 +95,12 @@ "erlang": [ { "command": "erlang-ls", + "vim-plugin": { + "name": "vim-erlang/vim-erlang-runtime", + "extensions": [ + "erl" + ] + }, "requires": [ "make", "rebar3" @@ -181,6 +200,12 @@ "kotlin": [ { "command": "kotlin-language-server", + "vim-plugin": { + "name": "udalov/kotlin-vim", + "extensions": [ + "kt" + ] + }, "requires": [ "java" ] @@ -205,6 +230,12 @@ "nim": [ { "command": "nimlsp", + "vim-plugin": { + "name": "zah/nim.vim", + "extensions": [ + "nim" + ] + }, "requires": [] } ], @@ -245,6 +276,13 @@ "reason": [ { "command": "reason-language-server", + "vim-plugin": { + "name": "reasonml-editor/vim-reason-plus", + "extensions": [ + "re", + "rei" + ] + }, "requires": [] } ], @@ -289,6 +327,12 @@ "swift": [ { "command": "sourcekit-lsp", + "vim-plugin": { + "name": "keith/swift.vim", + "extensions": [ + "swift" + ] + }, "requires": [ "sourcekit-lsp" ] @@ -297,6 +341,13 @@ "terraform": [ { "command": "terraform-lsp", + "vim-plugin": { + "name": "hashivim/vim-terraform", + "extensions": [ + "tf", + "tfvars" + ] + }, "requires": [] } ], @@ -339,6 +390,12 @@ "vue": [ { "command": "vls", + "vim-plugin": { + "name": "posva/vim-vue", + "extensions": [ + "vue" + ] + }, "requires": [ "npm" ] |