]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
When signature help is disabled for a lsp server, don't map the trigger characters...
authorYegappan Lakshmanan <yegappan@yahoo.com>
Wed, 26 Jul 2023 15:14:20 +0000 (08:14 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Wed, 26 Jul 2023 15:14:20 +0000 (08:14 -0700)
autoload/lsp/buffer.vim
autoload/lsp/diag.vim
autoload/lsp/lspserver.vim
autoload/lsp/options.vim
autoload/lsp/signature.vim
autoload/lsp/symbol.vim
doc/lsp.txt

index d2ccc8f477643d75c67a0b4335fe51b5afa6016d..64ae27aafe641b1ab64c6a80f1ea366a45bc1e1a 100644 (file)
@@ -4,9 +4,9 @@ vim9script
 
 import './util.vim'
 
-# A buffer can have one or more attached language servers.  The
+# A buffer can have one or more attached language servers.  The
 # "bufnrToServers" Dict contains the list of language servers attached to a
-# buffer. The buffer number is the key for the "bufnrToServers" Dict.  The
+# buffer. The buffer number is the key for the "bufnrToServers" Dict.  The
 # value is the List of attached language servers.
 var bufnrToServers: dict<list<dict<any>>> = {}
 
@@ -99,7 +99,7 @@ export def BufLspServerGet(bnr: number, feature: string = null_string): dict<any
 
   # LSP server is configured to be a provider for "feature"
   for lspserver in possibleLSPs
-    var has_feature = lspserver.features->get(feature, false)
+    var has_feature: bool = lspserver.features->get(feature, false)
     if has_feature
       return lspserver
     endif
@@ -108,7 +108,7 @@ export def BufLspServerGet(bnr: number, feature: string = null_string): dict<any
   # Return the first LSP server that supports "feature" and doesn't have it
   # disabled
   for lspserver in possibleLSPs
-    if !lspserver.features->has_key(feature)
+    if lspserver.featureEnabled(feature)
       return lspserver
     endif
   endfor
index dd902be8705bb9536de098b5ad572d27c885a1ed..7eba712dfbedd87710a4531476074c198dd5d8c1 100644 (file)
@@ -382,8 +382,7 @@ enddef
 # Param: PublishDiagnosticsParams
 export def DiagNotification(lspserver: dict<any>, uri: string, diags_arg: list<dict<any>>): void
   # Diagnostics are disabled for this server?
-  var diagSupported = lspserver.features->get('diagnostics', true)
-  if !diagSupported
+  if !lspserver.featureEnabled('diagnostics')
     return
   endif
 
@@ -800,8 +799,8 @@ export def LspDiagsJump(which: string, a_count: number = 0): void
   endif
 enddef
 
-# Return the sorted diagnostics for buffer "bnr".  Default is the current
-# buffer.  A copy of the diagnostics is returned so that the caller can modify
+# Return the sorted diagnostics for buffer "bnr".  Default is the current
+# buffer.  A copy of the diagnostics is returned so that the caller can modify
 # the diagnostics.
 export def GetDiagsForBuf(bnr: number = bufnr()): list<dict<any>>
   if !diagsMap->has_key(bnr) ||
index 66e1124cb72edbb0c5af6754397dd6e3528b6e57..fb64674cfc92714b5465561ebcffe868176fc36a 100644 (file)
@@ -508,6 +508,12 @@ def WaitForResponse(lspserver: dict<any>, req: dict<any>)
   endwhile
 enddef
 
+# Returns true when the "lspserver" has "feature" enabled.
+# By default, all the features of a lsp server are enabled.
+def FeatureEnabled(lspserver: dict<any>, feature: string): bool
+  return lspserver.features->get(feature, true)
+enddef
+
 # Retrieve the Workspace configuration asked by the server.
 # Request: workspace/configuration
 def WorkspaceConfigGet(lspserver: dict<any>, configItem: dict<any>): dict<any>
@@ -1864,6 +1870,7 @@ export def NewLspServer(serverParams: dict<any>): dict<any>
     decodeLocation: function(offset.DecodeLocation, [lspserver]),
     getPosition: function(GetPosition, [lspserver]),
     getTextDocPosition: function(GetTextDocPosition, [lspserver]),
+    featureEnabled: function(FeatureEnabled, [lspserver]),
     textdocDidOpen: function(TextdocDidOpen, [lspserver]),
     textdocDidClose: function(TextdocDidClose, [lspserver]),
     textdocDidChange: function(TextdocDidChange, [lspserver]),
index d6822286d16256b3cc0d66dd743d9c25172a0b4f..ea35c6cf3854dd9a9020e2e33e5c8198c72b8c02 100644 (file)
@@ -11,87 +11,122 @@ export var lspOptions: dict<any> = {
   # If true, diagnostics will be sent to ale, which will be responsible for
   # showing them.
   aleSupport: false,
+
   # In insert mode, complete the current symbol automatically
   # Otherwise, use omni-completion
   autoComplete: true,
+
   # In normal mode, highlight the current symbol automatically
   autoHighlight: false,
+
   # Automatically highlight diagnostics messages from LSP server
   autoHighlightDiags: true,
+
   # Automatically populate the location list with new diagnostics
   autoPopulateDiags: false,
+
   # icase | fuzzy | case match for language servers that replies with a full
   # list of completion items
   completionMatcher: 'case',
+
   # Due to a bug in the earlier versions of Vim, cannot use the
   # COMPLETIONMATCHER_CASE constant here for initialization.
   completionMatcherValue: 1,
+
   # diagnostics signs options
   diagSignErrorText: 'E>',
   diagSignHintText: 'H>',
   diagSignInfoText: 'I>',
   diagSignWarningText: 'W>',
+
   # In insert mode, echo the current symbol signature in the status line
   # instead of showing it in a popup
   echoSignature: false,
+
   # hide disabled code actions
   hideDisabledCodeActions: false,
+
   # Highlight diagnostics inline
   highlightDiagInline: true,
+
   # Show the symbol documentation in the preview window instead of in a popup
   hoverInPreview: false,
+
   # Don't print message when a configured language server is missing.
   ignoreMissingServer: false,
+
   # Focus on the location list window after ":LspDiag show"
   keepFocusInDiags: true,
+
   # Focus on the location list window after LspShowReferences
   keepFocusInReferences: true,
+
   # If true, apply the LSP server supplied text edits after a completion.
   # If a snippet plugin is going to apply the text edits, then set this to
   # false to avoid applying the text edits twice.
   completionTextEdit: true,
+
   # Alignment of virtual diagnostic text, when showDiagWithVirtualText is true
   # Allowed values: 'above' | 'below' | 'after' (default is 'above')
   diagVirtualTextAlign: 'above',
+
   # Suppress adding a new line on completion selection with <CR>
   noNewlineInCompletion: false,
+
   # Open outline window on right side
   outlineOnRight: false,
+
   # Outline window size
   outlineWinSize: 20,
+
   # Show diagnostic text in a balloon when the mouse is over the diagnostic
   showDiagInBalloon: true,
+
   # Make diagnostics show in a popup instead of echoing
   showDiagInPopup: true,
+
   # Suppress diagnostic hover from appearing when the mouse is over the line
   # Show a diagnostic message on a status line
   showDiagOnStatusLine: false,
+
   # Show a diagnostic messages using signs
   showDiagWithSign: true,
+
   # Show a diagnostic messages with virtual text
   showDiagWithVirtualText: false,
+
   # enable inlay hints
   showInlayHints: false,
+
   # In insert mode, show the current symbol signature automatically
   showSignature: true,
+
   # enable snippet completion support
   snippetSupport: false,
+
   # enable SirVer/ultisnips completion support
   ultisnipsSupport: false,
+
   # add to autocomplition list current buffer words
   useBufferCompletion: false,
+
   # Use a floating menu to show the code action menu instead of asking for
   # input
   usePopupInCodeAction: false,
+
   # ShowReferences in a quickfix list instead of a location list`
   useQuickfixForLocations: false,
+
   # enable hrsh7th/vim-vsnip completion support
   vsnipSupport: false,
+
   # Limit the time autocompletion searches for words in current buffer (in
   # milliseconds)
   bufferCompletionTimeout: 100,
+
   # Enable support for custom completion kinds
   customCompletionKinds: false,
+
   # A dictionary with all completion kinds that you want to customize
   completionKinds: {}
 }
index 66a325db7f400095c0800bc97822e5b20e150441..4764c784e4a395014ee92e78ac0f17545f19855d 100644 (file)
@@ -8,12 +8,14 @@ import './buffer.vim' as buf
 
 # close the signature popup window
 def CloseSignaturePopup(lspserver: dict<any>)
-  lspserver.signaturePopup->popup_close()
+  if lspserver.signaturePopup != -1
+    lspserver.signaturePopup->popup_close()
+  endif
   lspserver.signaturePopup = -1
 enddef
 
 def CloseCurBufSignaturePopup()
-  var lspserver: dict<any> = buf.CurbufGetServer()
+  var lspserver: dict<any> = buf.CurbufGetServer('signatureHelp')
   if lspserver->empty()
     return
   endif
@@ -34,6 +36,7 @@ export def BufferInit(lspserver: dict<any>)
   endif
 
   if !opt.lspOptions.showSignature
+      || !lspserver.featureEnabled('signatureHelp')
     # Show signature support is disabled
     return
   endif
index 2967aa32ad786696402733a1129adee7b24aed8e..7d26df82a3f6bc8ab28e2a8e35f5eb48e411a607 100644 (file)
@@ -129,7 +129,7 @@ def JumpToWorkspaceSymbol(cmdmods: string, popupID: number, result: number): voi
          # page, then use it.
          var winID = fname->bufwinid()
          if winID == -1
-           # not present in the current tab page.  Use the first window.
+           # not present in the current tab page.  Use the first window.
            winID = winList[0]
          endif
          winID->win_gotoid()
index f7cb09f875d1c34da941150ede3eed6208735724..c30220b495d7a2ccc6a12ba73d8dc2141f7616c8 100644 (file)
@@ -3,7 +3,7 @@
 
 Author: Yegappan Lakshmanan  (yegappan AT yahoo DOT com)
 For Vim version 9.0 and above
-Last change: June 25, 2023
+Last change: July 26, 2023
 
 ==============================================================================
 CONTENTS                                                     *lsp-contents*
@@ -405,7 +405,7 @@ Additionally the following configurations can be made:
 
                                                *lsp-cfg-traceLevel*
        traceLevel      (Optional) set the debug trace level for this language
-                       server.  Supported values are: "off", "debug" and
+                       server.  Supported values are: "off", "debug" and
                        "verbose".  By default this is seto "off".
 
 The language servers are added using the LspAddServer() function. This
@@ -1206,7 +1206,7 @@ can map these commands to keys and make it easier to invoke them.
                        Remove a folder from the workspace
 
 ==============================================================================
-6. Insert mode completion                  *lsp-ins-mode-completion*
+6. Insert Mode Completion                  *lsp-ins-mode-completion*
 
 By default, in insert mode, the LSP plugin automatically displays the matches
 for the symbol under the cursor in an insert-completion popup menu. You can
@@ -1332,7 +1332,7 @@ the current line.
 The ":LspDiag show" command creates a new location list with the current list
 of diagnostics for the current buffer.  To automatically add the diagnostics
 messages to the location list, you can set the 'autoPopulateDiags' option to
-true.  By default this option is set to false.  When new diagnostics are
+true.  By default this option is set to false.  When new diagnostics are
 received for a buffer, if a location list with the diagnostics is already
 present, then it is refreshed with the new diagnostics.
 
@@ -1352,10 +1352,10 @@ message area instead, you can set the 'showDiagInPopup' option to false.  By
 default this is set to true.
 
 The lsp#diag#GetDiagsForBuf() function can be used to get all the LSP
-diagnostics in a buffer.  This function optionally accepts a buffer number.
+diagnostics in a buffer.  This function optionally accepts a buffer number.
 If the buffer number argument is not specified, then the current buffer is
-used.  This function returns a |List| of diagnostics sorted by their line and
-column number.  Each diagnostic is a |Dict| returned by the language server.
+used.  This function returns a |List| of diagnostics sorted by their line and
+column number.  Each diagnostic is a |Dict| returned by the language server.
 
 ==============================================================================
 8. Tag Function                                        *lsp-tagfunc*
@@ -1434,7 +1434,7 @@ LspAttached                       A |User| autocommand fired when the LSP client
 LspDiagsUpdated                        A |User| autocommand invoked when new
                                diagnostics are received from the language
                                server.  This is invoked after the LSP client
-                               has processed the diagnostics.  The function
+                               has processed the diagnostics.  The function
                                lsp#diag#GetDiagsForBuf() can be used to get
                                all the diagnostics for a buffer.