From 43885105f647140418f4db237af48e0244891059 Mon Sep 17 00:00:00 2001
From: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Thu, 29 Jun 2023 21:25:36 -0700
Subject: [PATCH] Don't check the capabilities for language servers which are
 not ready.  Update help text

---
 autoload/lsp/buffer.vim |  2 +-
 autoload/lsp/lsp.vim    | 12 +++++++++++-
 doc/lsp.txt             | 34 ++++++++++++++++++++++++++--------
 3 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/autoload/lsp/buffer.vim b/autoload/lsp/buffer.vim
index 7c1b6c1..54c191b 100644
--- a/autoload/lsp/buffer.vim
+++ b/autoload/lsp/buffer.vim
@@ -85,7 +85,7 @@ export def BufLspServerGet(bnr: number, feature: string = null_string): dict<any
   var possibleLSPs: list<dict<any>> = []
 
   for lspserver in bufnrToServers[bnr]
-    if !SupportedCheckFn(lspserver)
+    if !lspserver.ready || !SupportedCheckFn(lspserver)
       continue
     endif
 
diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim
index 4113104..43f96c5 100644
--- a/autoload/lsp/lsp.vim
+++ b/autoload/lsp/lsp.vim
@@ -853,6 +853,16 @@ enddef
 
 # open a window and display all the symbols in a file (outline)
 export def Outline(cmdmods: string, winsize: number)
+  var fname: string = @%
+  if fname->empty()
+    return
+  endif
+
+  var lspserver: dict<any> = buf.CurbufGetServerChecked('documentSymbol')
+  if lspserver->empty() || !lspserver.running || !lspserver.ready
+    return
+  endif
+
   outline.OpenOutlineWindow(cmdmods, winsize)
   g:LspRequestDocSymbols()
 enddef
@@ -864,7 +874,7 @@ export def ShowDocSymbols()
     return
   endif
 
-  var lspserver: dict<any> = buf.CurbufGetServer('documentSymbol')
+  var lspserver: dict<any> = buf.CurbufGetServerChecked('documentSymbol')
   if lspserver->empty() || !lspserver.running || !lspserver.ready
     return
   endif
diff --git a/doc/lsp.txt b/doc/lsp.txt
index a75277d..cec1a23 100644
--- a/doc/lsp.txt
+++ b/doc/lsp.txt
@@ -523,7 +523,7 @@ hideDisabledCodeActions |Boolean| option. Hide all the disabled code actions.
 			By default this is set to false.
 
 						*lsp-opt-highlightDiagInline*
-highlightDiagInline	|Boolean| option.  Highlight the diagnostics inline
+highlightDiagInline	|Boolean| option.  Highlight the diagnostics inline.
 			By default this is set to false.
 
 						*lsp-opt-hoverInPreview*
@@ -1256,16 +1256,34 @@ display the entire diagnostic message from the language server for the current
 line.
 
 By default, the lines with a diagnostic message have a sign placed on them and
-are highlighted.  You can temporarily disable them for the current Vim session
-using the |:LspDiagHighlightDisable| command and re-enable them using the
-|:LspDiagHighlightEnable| command.
-
-To disable the automatic placement of signs on the lines with a diagnostic
-message, you can set the 'autoHighlightDiags' option to false: >
+are highlighted.  You can disable the automatic sign placement by setting the
+"showDiagWithSign" option to v:false.  By default, this option is set to
+v:true.  The line with the diagnostics is highlighted using the "LspDiagLine"
+highlight group.
+
+You can also display the diagnostic message as a virtual text near the
+location of the diagnostics by setting the "showDiagWithVirtualText" option to
+v:true.  This needs Vim version 9.0.1157 or later.  By default this option is
+set to v:false.  The position of the virtual text is controlled by the
+"diagVirtualTextAlign" option.  By default, this is set to 'above'.  The other
+supported values are 'below' and 'after'.
+
+The range of text for a diagnostic message can be automatically highlighted by
+setting the "highlightDiagInline" option to v:true.  By default, this option
+is set to v:false.  The text is highlighted using the "LspDiagInlineError" or
+"LspDiagInlineHint" or "LspDiagInlineInfo" or "LspDiagInlineWarning" highlight
+group.
+
+You can temporarily disable the automatic diagnostic highlighting for the
+current Vim session using the |:LspDiagHighlightDisable| command and re-enable
+them using the |:LspDiagHighlightEnable| command.
+
+To disable the automatic highlighting of the diagnostics, you can set the
+'autoHighlightDiags' option to v:false: >
 
 	LspOptionsSet({'autoHighlightDiags': false})
 <
-By default the 'autoHighlightDiags' option is set to true.
+By default the 'autoHighlightDiags' option is set to v:true.
 
 The function lsp#lsp#ErrorCount() function can be used to get the count of the
 diagnostic messages in the current buffer by type.  This function returns a
-- 
2.51.0