autoload/lsp/lsp.vim | 13 +++++++++++++ diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 5d5d6dc952c5b39e41aa38d233d54afb358a62aa..e911e2131234ff8b60a15fb822c800ef68638492 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -97,6 +97,19 @@ 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()