]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
In Vim9 scripts, 'ignorecase' is not used for comparison operators
authorYegappan Lakshmanan <yegappan@yahoo.com>
Fri, 21 Apr 2023 05:05:30 +0000 (22:05 -0700)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Fri, 21 Apr 2023 05:05:30 +0000 (22:05 -0700)
autoload/lsp/completion.vim
autoload/lsp/diag.vim
autoload/lsp/inlayhints.vim
autoload/lsp/lsp.vim
autoload/lsp/lspserver.vim
autoload/lsp/util.vim
doc/lsp.txt

index 93a2ad58187e028033bbb1be110cd3d51b766c98..3088dac9b747e73721c0a832f2e6068c120b8f76 100644 (file)
@@ -103,7 +103,7 @@ def MakeValidWord(str_arg: string): string
   if valid->empty()
     return str
   endif
-  if valid =~# ':$'
+  if valid =~ ':$'
     return valid[: -2]
   endif
   return valid
@@ -268,7 +268,7 @@ export def CompletionReply(lspserver: dict<any>, cItems: any)
   if opt.lspOptions.completionMatcher != 'fuzzy'
     # Lexographical sort (case-insensitive).
     completeItems->sort((a, b) =>
-      a.score ==# b.score ? 0 : a.score >? b.score ? 1 : -1)
+      a.score == b.score ? 0 : a.score >? b.score ? 1 : -1)
   endif
 
   if opt.lspOptions.autoComplete && !lspserver.omniCompletePending
@@ -309,7 +309,7 @@ def ShowCompletionDocumentation(cItem: any)
       || cInfo.selected == -1
       || cInfo.items[cInfo.selected]->type() != v:t_dict
       || cInfo.items[cInfo.selected].user_data->type() != v:t_dict
-      || cInfo.items[cInfo.selected].user_data.label !=# cItem.label
+      || cInfo.items[cInfo.selected].user_data.label != cItem.label
     return
   endif
 
@@ -358,7 +358,7 @@ def ShowCompletionDocumentation(cItem: any)
       || cInfo.selected == -1
       || cInfo.items[cInfo.selected]->type() != v:t_dict
       || cInfo.items[cInfo.selected].user_data->type() != v:t_dict
-      || cInfo.items[cInfo.selected].user_data.label !=# cItem.label
+      || cInfo.items[cInfo.selected].user_data.label != cItem.label
     return
   endif
 
index 4478fcb9cd998289a565aa710449b84c21ab8c28..821c091c7f3241f6df378d7fc66babe5b2af17b3 100644 (file)
@@ -159,11 +159,11 @@ def DiagsRefresh(bnr: number)
   var diag_wrap: string = 'truncate'
   var diag_symbol: string = '┌─'
 
-  if opt.lspOptions.diagVirtualTextAlign ==# 'below'
+  if opt.lspOptions.diagVirtualTextAlign == 'below'
     diag_align = 'below'
     diag_wrap = 'truncate'
     diag_symbol = '└─'
-  elseif opt.lspOptions.diagVirtualTextAlign ==# 'after'
+  elseif opt.lspOptions.diagVirtualTextAlign == 'after'
     diag_align = 'after'
     diag_wrap = 'wrap'
     diag_symbol = 'E>'
index 9b07343bf66cf920de543cd47131bc4c4c2f6ef5..3d3384b8d352ca9c3298a982ad7c44ec5f0e3064 100644 (file)
@@ -29,7 +29,7 @@ export def InlayHintsReply(lspserver: dict<any>, inlayHints: any)
 
   InlayHintsClear(lspserver)
 
-  if mode() !=# 'n'
+  if mode() != 'n'
     # Update inlay hints only in normal mode
     return
   endif
@@ -44,10 +44,10 @@ export def InlayHintsReply(lspserver: dict<any>, inlayHints: any)
     endif
 
     var kind = hint->has_key('kind') ? hint.kind->string() : '1'
-    if kind ==# "'type'" || kind ==# '1'
+    if kind == "'type'" || kind == '1'
       prop_add(hint.position.line + 1, hint.position.character + 1,
                {type: 'LspInlayHintsType', text: label, bufnr: bufnum})
-    elseif kind ==# "'parameter'" || kind ==# '2'
+    elseif kind == "'parameter'" || kind == '2'
       prop_add(hint.position.line + 1, hint.position.character + 1,
                {type: 'LspInlayHintsParam', text: label, bufnr: bufnum})
     endif
index ebfc63e0010833a9cc3d62c9d0e57e1f00d0cee4..b2f6dd3e0bc4bbd57be11389573395d95f4ede18 100644 (file)
@@ -98,13 +98,13 @@ def ServerDebug(arg: string)
   endif
 
   for lspserver in lspservers
-    if arg ==# 'on'
+    if arg == 'on'
       util.ClearTraceLogs(lspserver.logfile)
       util.ClearTraceLogs(lspserver.errfile)
       lspserver.debug = true
-    elseif arg ==# 'off'
+    elseif arg == 'off'
       lspserver.debug = false
-    elseif arg ==# 'messages'
+    elseif arg == 'messages'
       util.ServerMessagesShow(lspserver.logfile)
     else
       util.ServerMessagesShow(lspserver.errfile)
@@ -194,7 +194,7 @@ def ShowServer(arg: string)
 
   var windowName: string = ''
   var lines: list<string> = []
-  if arg == '' || arg ==# 'status'
+  if arg == '' || arg == 'status'
     windowName = $'LangServer-Status'
     for lspserver in lspservers
       if !lines->empty()
@@ -208,7 +208,7 @@ def ShowServer(arg: string)
       endif
       lines->add(msg)
     endfor
-  elseif arg ==# 'capabilities'
+  elseif arg == 'capabilities'
     windowName = $'LangServer-Capabilities'
     for lspserver in lspservers
       if !lines->empty()
@@ -216,7 +216,7 @@ def ShowServer(arg: string)
       endif
       lines->extend(lspserver.getCapabilities())
     endfor
-  elseif arg ==# 'initializeRequest'
+  elseif arg == 'initializeRequest'
     windowName = $'LangServer-InitializeRequest'
     for lspserver in lspservers
       if !lines->empty()
@@ -224,7 +224,7 @@ def ShowServer(arg: string)
       endif
       lines->extend(lspserver.getInitializeRequest())
     endfor
-  elseif arg ==# 'messages'
+  elseif arg == 'messages'
     windowName = $'LangServer-Messages'
     for lspserver in lspservers
       if !lines->empty()
@@ -1124,12 +1124,12 @@ export def LspServerComplete(arglead: string, cmdline: string, cursorPos: number
   endif
 
   var cmd = cmdline->strpart(wordBegin, wordEnd - wordBegin)
-  if cmd ==# 'debug'
+  if cmd == 'debug'
     return LspServerDebugComplete(arglead, cmdline, wordEnd)
-  elseif cmd ==# 'restart'
-  elseif cmd ==# 'show'
+  elseif cmd == 'restart'
+  elseif cmd == 'show'
     return LspServerShowComplete(arglead, cmdline, wordEnd)
-  elseif cmd ==# 'trace'
+  elseif cmd == 'trace'
     return LspServerTraceComplete(arglead, cmdline, wordEnd)
   endif
 
@@ -1139,23 +1139,23 @@ enddef
 # ":LspServer" command handler
 export def LspServerCmd(args: string)
   if args->stridx('debug') == 0
-    if args[5] ==# ' '
+    if args[5] == ' '
       var subcmd = args[6 : ]->trim()
       ServerDebug(subcmd)
     else
       util.ErrMsg('Argument required')
     endif
-  elseif args ==# 'restart'
+  elseif args == 'restart'
     RestartServer()
   elseif args->stridx('show') == 0
-    if args[4] ==# ' '
+    if args[4] == ' '
       var subcmd = args[5 : ]->trim()
       ShowServer(subcmd)
     else
       util.ErrMsg('Argument required')
     endif
   elseif args->stridx('trace') == 0
-    if args[5] ==# ' '
+    if args[5] == ' '
       var subcmd = args[6 : ]->trim()
       ServerTraceSet(subcmd)
     else
index 69af662bb7a921a9852ab8a038be795d97f01398..b229fdecbde41e02887b3f6954b61aaf40170d27 100644 (file)
@@ -170,7 +170,7 @@ def InitServer(lspserver: dict<any>, bnr: number)
     var bufDirPrefix = bufDir[0 : cwd->strcharlen() - 1]
     if &fileignorecase
         ? bufDirPrefix ==? cwd
-        : bufDirPrefix ==# cwd
+        : bufDirPrefix == cwd
       rootPath = cwd
     else
       rootPath = bufDir
@@ -667,11 +667,11 @@ def GotoSymbolLoc(lspserver: dict<any>, msg: string, peekSymbol: bool,
   var reply = lspserver.rpc(msg, GetLspTextDocPosition(true), false)
   if reply->empty() || reply.result->empty()
     var emsg: string
-    if msg ==# 'textDocument/declaration'
+    if msg == 'textDocument/declaration'
       emsg = 'symbol declaration is not found'
-    elseif msg ==# 'textDocument/typeDefinition'
+    elseif msg == 'textDocument/typeDefinition'
       emsg = 'symbol type definition is not found'
-    elseif msg ==# 'textDocument/implementation'
+    elseif msg == 'textDocument/implementation'
       emsg = 'symbol implementation is not found'
     else
       emsg = 'symbol definition is not found'
@@ -688,11 +688,11 @@ def GotoSymbolLoc(lspserver: dict<any>, msg: string, peekSymbol: bool,
       # requested with 'count', display the locations in a location list.
       if reply.result->len() > 1
         var title: string = ''
-        if msg ==# 'textDocument/declaration'
+        if msg == 'textDocument/declaration'
           title = 'Declarations'
-        elseif msg ==# 'textDocument/typeDefinition'
+        elseif msg == 'textDocument/typeDefinition'
           title = 'Type Definitions'
-        elseif msg ==# 'textDocument/implementation'
+        elseif msg == 'textDocument/implementation'
           title = 'Implementations'
         else
           title = 'Definitions'
@@ -904,8 +904,9 @@ def DocHighlightReply(lspserver: dict<any>, docHighlightReply: any,
                     bufnr: bnr,
                     type: propName})
     catch /E966\|E964/ # Invalid lnum | Invalid col
-      # Highlight arrive asynchronous and the document changed while they wore
-      # send.
+      # Highlight replies arrive asynchronously and the document might have
+      # been modified in the mean time.  As the reply is stale, ignore invalid
+      # line number and column number errors.
     endtry
   endfor
 enddef
index 558b82c50f603f6053fe8007f291d10426ad6cfd..548856131ff8471f9db0ababb8a24ac9cf3b43aa 100644 (file)
@@ -104,7 +104,7 @@ enddef
 # Returns if the URI refers to a remote file (e.g. ssh://)
 # Credit: vim-lsp plugin
 export def LspUriRemote(uri: string): bool
-  return uri =~# '^\w\+::' || uri =~# '^[a-z][a-z0-9+.-]*://'
+  return uri =~ '^\w\+::' || uri =~ '^[a-z][a-z0-9+.-]*://'
 enddef
 
 # Convert a Vim filename to an LSP URI (file://<absolute_path>)
@@ -248,7 +248,7 @@ export def FindNearestRootDir(startDir: string, files: list<any>): string
     if file->type() != v:t_string || file == ''
       continue
     endif
-    var isDir = file[-1 : ] ==# '/' || file[-1 : ] ==# '\'
+    var isDir = file[-1 : ] == '/' || file[-1 : ] == '\'
     var relPath: string
     if isDir
       relPath = finddir(file, $'{startDir};')
index 53e44d71fa125411a059139d4825e983b5e69ef1..0e9f3fdd3aa75b6f50833616faaa9a996e1e4bf9 100644 (file)
@@ -1012,21 +1012,22 @@ 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
 use the keys described in |popupmenu-keys| with this menu.
 
-To disable the auto-compeltion, you can set the autoComplete option to v:false
-in your .vimrc file: >
+To disable the auto-completion for all the files, you can set the
+'autoComplete' option to v:false in your .vimrc file: >
 
        call LspOptionsSet({'autoComplete': v:false})
 <
-If this variable is set, then the LSP plugin doesn't automatically start
+If this variable is set, then the LSP plugin will not automatically start
 completion in insert mode and instead supports omni-completion (|compl-omni|).
 It sets the 'omnifunc' option for the buffers which have a registered language
 server. To complete a symbol in insert mode manually, you can press CTRL-X
 CTRL-O to invoke completion using the items suggested by the language server.
 
-You can also enable or disable omni-completion based on a file type by setting
-the 'omnicompl' item to 'false' when registering a lsp server for the
-filetype. If this item is not specified, then omni-completion is enabled by
-default. The following example disables omni-completion for python: >
+You can also enable or disable omni-completion for a specific language
+server by setting the 'omnicompl' item to 'false' when registering a lsp
+server for the filetype. If this item is not specified, then omni-completion
+is enabled by default. The following example disables omni-completion for
+python: >
 
        let lspServers = [
                \     {