autoload/lsp/lsp.vim | 24 +++++++++++------------- plugin/lsp.vim | 4 ++++ diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index e911e2131234ff8b60a15fb822c800ef68638492..9442717a04679dfdc14bfbd3c99ebfc1f7f3f268 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -97,19 +97,6 @@ util.ClearTraceLogs() util.ServerTrace(true) enddef -# Get LSP server status for filetype 'ftype'. -# Return true if running, otherwise false if not found or not running. -# But lsp init for cur 'buf' maybe not done yet even this func return true, -# check 'g:LspServerReady()' for that instead. -def g:LspServerStatus(ftype: string): bool - for [ft, lspserver] in ftypeServerMap->items() - if ftype ==# ft - return lspserver.running - endif - endfor - return v:false -enddef - # Show information about all the LSP servers export def ShowServers() for [ftype, lspserver] in ftypeServerMap->items() @@ -122,6 +109,17 @@ endif msg ..= $' {lspserver.path}' :echomsg msg endfor +enddef + +# Get LSP server status for filetype 'ftype' +# Return true if running, or false if not found or not running +export def ServerStatus(ftype: string): bool + for [ft, lspserver] in ftypeServerMap->items() + if ftype ==# ft + return lspserver.running + endif + endfor + return v:false enddef # Go to a definition using "textDocument/definition" LSP request diff --git a/plugin/lsp.vim b/plugin/lsp.vim index f0df9da9fb910cc7dc033e6415caea656a693d6d..64da174a76c5dd719d6baa0cfa1b6d92d54c48ae 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -26,6 +26,10 @@ def g:LspServerReady(): bool return lsp.ServerReady() enddef +def g:LspServerStatus(ftype: string): bool + return lsp.ServerStatus(ftype) +enddef + # Command line completion function for the LspSetTrace command. def LspServerTraceComplete(arglead: string, cmdline: string, cursorpos: number): list var l = ['off', 'messages', 'verbose']