From: Yegappan Lakshmanan Date: Fri, 21 Apr 2023 05:05:30 +0000 (-0700) Subject: In Vim9 scripts, 'ignorecase' is not used for comparison operators X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9db67aef14bc9198831c9469fd925b8e3c62abf7;p=vim-lsp.git In Vim9 scripts, 'ignorecase' is not used for comparison operators --- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 93a2ad5..3088dac 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -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, 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 diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index 4478fcb..821c091 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -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>' diff --git a/autoload/lsp/inlayhints.vim b/autoload/lsp/inlayhints.vim index 9b07343..3d3384b 100644 --- a/autoload/lsp/inlayhints.vim +++ b/autoload/lsp/inlayhints.vim @@ -29,7 +29,7 @@ export def InlayHintsReply(lspserver: dict, 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, 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 diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index ebfc63e..b2f6dd3 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -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 = [] - 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 diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 69af662..b229fde 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -170,7 +170,7 @@ def InitServer(lspserver: dict, 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, 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, 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, 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 diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index 558b82c..5488561 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -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://) @@ -248,7 +248,7 @@ export def FindNearestRootDir(startDir: string, files: list): 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};') diff --git a/doc/lsp.txt b/doc/lsp.txt index 53e44d7..0e9f3fd 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -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 = [ \ {