]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
issue_5: adding func to get LSP server status for ft.
authorshane.xb.qian <shane.qian@foxmail.com>
Wed, 17 Nov 2021 02:57:28 +0000 (10:57 +0800)
committershane.xb.qian <shane.qian@foxmail.com>
Wed, 26 Oct 2022 11:08:33 +0000 (19:08 +0800)
autoload/lsp/lsp.vim

index 5d5d6dc952c5b39e41aa38d233d54afb358a62aa..e911e2131234ff8b60a15fb822c800ef68638492 100644 (file)
@@ -97,6 +97,19 @@ export def EnableServerTrace()
   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()