aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-02-18 18:03:38 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-02-18 18:03:38 +0900
commit40fa3b6cbb9c20786cba8b998e03326724ad8253 (patch)
tree19395c3cd3fb2ee221913fe0bbb8fe30d6f0df65
parent6fa847f227a140a302062801d780d79d77b2cc07 (diff)
downloadvim-lsp-settings-40fa3b6cbb9c20786cba8b998e03326724ad8253.tar.gz
vim-lsp-settings-40fa3b6cbb9c20786cba8b998e03326724ad8253.tar.bz2
vim-lsp-settings-40fa3b6cbb9c20786cba8b998e03326724ad8253.zip
Add LspSettingsStatus
-rw-r--r--autoload/lsp_settings/profile.vim36
-rw-r--r--plugin/lsp_settings.vim1
2 files changed, 37 insertions, 0 deletions
diff --git a/autoload/lsp_settings/profile.vim b/autoload/lsp_settings/profile.vim
index a035032..4567f07 100644
--- a/autoload/lsp_settings/profile.vim
+++ b/autoload/lsp_settings/profile.vim
@@ -29,3 +29,39 @@ function! lsp_settings#profile#edit_local() abort
setlocal nomodified
endif
endfunction
+
+let s:color_map = {
+\ 'exited': 'Error',
+\ 'starting': 'MoreMsg',
+\ 'failed': 'WarningMsg',
+\ 'running': 'Keyword',
+\ 'not running': 'NonText'
+\}
+
+function! lsp_settings#profile#status() abort
+ let l:settings = lsp_settings#settings()
+ let l:active_servers = lsp#get_whitelisted_servers()
+ for l:ft in keys(l:settings)
+ let l:servers = l:settings[l:ft]
+ for l:v in l:servers
+ if index(l:active_servers, l:v.command) != -1
+ let l:status = lsp#get_server_status(l:v.command)
+ echon l:v.command . ': '
+ exec 'echohl' s:color_map[l:status]
+ echon l:status
+ echohl None
+ elseif lsp_settings#executable(l:v.command)
+ echon l:v.command . ': '
+ echohl vimFilter
+ echon 'not running'
+ echohl None
+ else
+ echon l:v.command . ': '
+ echohl vimOption
+ echon 'not installed'
+ echohl None
+ endif
+ echo ''
+ endfor
+ endfor
+endfunction
diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim
index 5898982..ed9cc73 100644
--- a/plugin/lsp_settings.vim
+++ b/plugin/lsp_settings.vim
@@ -10,6 +10,7 @@ let g:lsp_settings_root_markers = get(g:, 'lsp_settings_root_markers', [
\ '.bzr/'
\ ])
+command! -nargs=0 LspSettingsStatus call lsp_settings#profile#status()
command! -nargs=0 LspSettingsLocalEdit call lsp_settings#profile#edit_local()
call lsp_settings#init()