]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use string interpolation and single quoted strings
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 11 Mar 2023 23:47:30 +0000 (15:47 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 11 Mar 2023 23:47:30 +0000 (15:47 -0800)
autoload/lsp/codeaction.vim
autoload/lsp/completion.vim
autoload/lsp/diag.vim
autoload/lsp/handlers.vim
autoload/lsp/lsp.vim
autoload/lsp/lspserver.vim
autoload/lsp/markdown.vim
autoload/lsp/selection.vim
autoload/lsp/symbol.vim
autoload/lsp/textedit.vim
autoload/lsp/typehierarchy.vim

index 81994946c5c5af0a9b7c950d46d52da55a4b6e6c..08557671e9fad1772bb14ffd934df654644925de 100644 (file)
@@ -21,6 +21,7 @@ def DoCommand(lspserver: dict<any>, cmd: dict<any>)
   endif
 enddef
 
+# Apply the code action selected by the user.
 export def HandleCodeAction(lspserver: dict<any>, selAction: dict<any>)
   # textDocument/codeAction can return either Command[] or CodeAction[].
   # If it is a CodeAction, it can have either an edit, a command or both.
@@ -43,6 +44,16 @@ export def HandleCodeAction(lspserver: dict<any>, selAction: dict<any>)
   endif
 enddef
 
+# Process the list of code actions returned by the LSP server, ask the user to
+# choose one action from the list and then apply it.
+# If "query" is a number, then apply the corresponding action in the list.
+# If "query" is a regular expression starting with "/", then apply the action
+# matching the search string in the list.
+# If "query" is a regular string, then apply the action matching the string.
+# If "query" is an empty string, then if the "usePopupInCodeAction" option is
+# configured by the user, then display the list of items in a popup menu.
+# Otherwise display the items in an input list and prompt the user to select
+# an action.
 export def ApplyCodeAction(lspserver: dict<any>, actionlist: list<dict<any>>, query: string): void
   var actions = actionlist
 
@@ -106,7 +117,7 @@ export def ApplyCodeAction(lspserver: dict<any>, actionlist: list<dict<any>>, qu
       },
     })
   else
-    choice = inputlist(["Code action:"] + text)
+    choice = inputlist(['Code action:'] + text)
   endif
 
   if choice < 1 || choice > text->len()
index 5c6554e382459bd7a2645b1c2c5ef74c24d1423f..841ec0f336d5c1eac5af7dda7f3a8a3922a7a8c0 100644 (file)
@@ -142,7 +142,7 @@ export def CompletionReply(lspserver: dict<any>, cItems: any)
     endif
 
     if completeItems->len() == 1
-       && getline('.')->matchstr(completeItems[0].word .. '\>') != ''
+       && getline('.')->matchstr($'{completeItems[0].word}\>') != ''
       # only one complete match. No need to show the completion popup
       return
     endif
index 84a41c4765ed2b1a4020ad581a1408330b014545..4382c4a9233b44d96260aaba6003d1f50bce520a 100644 (file)
@@ -257,14 +257,14 @@ export def ShowCurrentDiagInStatusLine(lspserver: dict<any>)
   if !diag->empty()
     # 15 is a enough length not to cause line break
     var max_width = &columns - 15
-    var code = ""
+    var code = ''
     if diag->has_key('code')
       code = $'[{diag.code}] '
     endif
-    var msgNoLineBreak = code .. substitute(substitute(diag.message, "\n", " ", ""), "\\n", " ", "")
+    var msgNoLineBreak = code .. substitute(substitute(diag.message, "\n", ' ', ''), "\\n", ' ', '')
     echo msgNoLineBreak[ : max_width]
   else
-    echo ""
+    echo ''
   endif
 enddef
 
index 70d56c86b866f99e01ec4e8c51f617c6758ce499..16290d48f007a41b05db80b5500a7b7fa3c95f72 100644 (file)
@@ -214,9 +214,9 @@ export def ProcessMessages(lspserver: dict<any>): void
       else
        # request failed
        var emsg: string = msg.error.message
-       emsg ..= ', code = ' .. msg.error.code
+       emsg ..= $', code = {msg.error.code}'
        if msg.error->has_key('data')
-         emsg = emsg .. ', data = ' .. msg.error.data->string()
+         emsg ..= $', data = {msg.error.data->string()}'
        endif
        util.ErrMsg($'Error(LSP): request {req.method} failed ({emsg})')
       endif
index 990a94e57ffa62d2e0072c142c8af2892b55e036..827b7bcd74b79c81e7a00beeb24ddd5210422e61 100644 (file)
@@ -81,7 +81,7 @@ enddef
 # Show information about all the LSP servers
 export def ShowServers()
   for [ftype, lspserver] in ftypeServerMap->items()
-    var msg = ftype .. "    "
+    var msg = $'{ftype}    '
     if lspserver.running
       msg ..= 'running'
     else
@@ -299,7 +299,7 @@ export def AddFile(bnr: number): void
   endif
 
   # Skip remote files
-  if util.LspUriRemote(bnr->bufname()->fnamemodify(":p"))
+  if util.LspUriRemote(bnr->bufname()->fnamemodify(':p'))
     return
   endif
 
@@ -730,7 +730,7 @@ export def SymbolSearch(queryArg: string)
 
   var query: string = queryArg
   if query == ''
-    query = input("Lookup symbol: ", expand('<cword>'))
+    query = input('Lookup symbol: ', expand('<cword>'))
     if query == ''
       return
     endif
@@ -759,7 +759,7 @@ export def AddWorkspaceFolder(dirArg: string)
 
   var dirName: string = dirArg
   if dirName == ''
-    dirName = input("Add Workspace Folder: ", getcwd(), 'dir')
+    dirName = input('Add Workspace Folder: ', getcwd(), 'dir')
     if dirName == ''
       return
     endif
@@ -782,7 +782,7 @@ export def RemoveWorkspaceFolder(dirArg: string)
 
   var dirName: string = dirArg
   if dirName == ''
-    dirName = input("Remove Workspace Folder: ", getcwd(), 'dir')
+    dirName = input('Remove Workspace Folder: ', getcwd(), 'dir')
     if dirName == ''
       return
     endif
index 0f6385b919ab2a8171626b0e5a587a20a9457ed3..7d9fc77ead282a37316f391465215ab3227c6103 100644 (file)
@@ -481,7 +481,7 @@ enddef
 # Stop a LSP server
 def StopServer(lspserver: dict<any>): number
   if !lspserver.running
-    util.WarnMsg("LSP server is not running")
+    util.WarnMsg('LSP server is not running')
     return 0
   endif
 
@@ -563,7 +563,7 @@ def SendResponse(lspserver: dict<any>, request: dict<any>, result: any, error: d
        && (request.id->trim() =~ '[^[:digit:]]\+'
            || request.id->trim() == ''))
     || (request.id->type() != v:t_string && request.id->type() != v:t_number)
-    util.ErrMsg("Error: request.id of response to LSP server is not a correct number")
+    util.ErrMsg('Error: request.id of response to LSP server is not a correct number')
     return
   endif
   var resp: dict<any> = lspserver.createResponse(
@@ -625,9 +625,9 @@ def Rpc(lspserver: dict<any>, method: string, params: any): dict<any>
   if reply->has_key('error')
     # request failed
     var emsg: string = reply.error.message
-    emsg ..= ', code = ' .. reply.error.code
+    emsg ..= $', code = {reply.error.code}'
     if reply.error->has_key('data')
-      emsg ..= ', data = ' .. reply.error.data->string()
+      emsg ..= $', data = {reply.error.data->string()}'
     endif
     util.ErrMsg($'Error(LSP): request {method} failed ({emsg})')
   endif
@@ -813,7 +813,7 @@ enddef
 def GetCompletion(lspserver: dict<any>, triggerKind_arg: number, triggerChar: string): void
   # Check whether LSP server supports completion
   if !lspserver.isCompletionProvider
-    util.ErrMsg("Error: LSP server does not support completion")
+    util.ErrMsg('Error: LSP server does not support completion')
     return
   endif
 
@@ -838,7 +838,7 @@ enddef
 def ResolveCompletion(lspserver: dict<any>, item: dict<any>): void
   # Check whether LSP server supports completion item resolve
   if !lspserver.isCompletionResolveProvider
-    util.ErrMsg("Error: LSP server does not support completion item resolve")
+    util.ErrMsg('Error: LSP server does not support completion item resolve')
     return
   endif
 
@@ -903,7 +903,7 @@ enddef
 def GotoDefinition(lspserver: dict<any>, peek: bool, cmdmods: string)
   # Check whether LSP server supports jumping to a definition
   if !lspserver.isDefinitionProvider
-    util.ErrMsg("Error: Jumping to a symbol definition is not supported")
+    util.ErrMsg('Error: Jumping to a symbol definition is not supported')
     return
   endif
 
@@ -917,7 +917,7 @@ enddef
 def GotoDeclaration(lspserver: dict<any>, peek: bool, cmdmods: string)
   # Check whether LSP server supports jumping to a declaration
   if !lspserver.isDeclarationProvider
-    util.ErrMsg("Error: Jumping to a symbol declaration is not supported")
+    util.ErrMsg('Error: Jumping to a symbol declaration is not supported')
     return
   endif
 
@@ -931,7 +931,7 @@ enddef
 def GotoTypeDef(lspserver: dict<any>, peek: bool, cmdmods: string)
   # Check whether LSP server supports jumping to a type definition
   if !lspserver.isTypeDefinitionProvider
-    util.ErrMsg("Error: Jumping to a symbol type definition is not supported")
+    util.ErrMsg('Error: Jumping to a symbol type definition is not supported')
     return
   endif
 
@@ -945,7 +945,7 @@ enddef
 def GotoImplementation(lspserver: dict<any>, peek: bool, cmdmods: string)
   # Check whether LSP server supports jumping to a implementation
   if !lspserver.isImplementationProvider
-    util.ErrMsg("Error: Jumping to a symbol implementation is not supported")
+    util.ErrMsg('Error: Jumping to a symbol implementation is not supported')
     return
   endif
 
@@ -983,7 +983,7 @@ enddef
 def ShowSignature(lspserver: dict<any>): void
   # Check whether LSP server supports signature help
   if !lspserver.isSignatureHelpProvider
-    util.ErrMsg("Error: LSP server does not support signature help")
+    util.ErrMsg('Error: LSP server does not support signature help')
     return
   endif
 
@@ -1031,7 +1031,7 @@ enddef
 def ShowReferences(lspserver: dict<any>, peek: bool): void
   # Check whether LSP server supports getting reference information
   if !lspserver.isReferencesProvider
-    util.ErrMsg("Error: LSP server does not support showing references")
+    util.ErrMsg('Error: LSP server does not support showing references')
     return
   endif
 
@@ -1089,7 +1089,7 @@ enddef
 def DocHighlight(lspserver: dict<any>): void
   # Check whether LSP server supports getting highlight information
   if !lspserver.isDocumentHighlightProvider
-    util.ErrMsg("Error: LSP server does not support document highlight")
+    util.ErrMsg('Error: LSP server does not support document highlight')
     return
   endif
 
@@ -1105,7 +1105,7 @@ enddef
 def GetDocSymbols(lspserver: dict<any>, fname: string): void
   # Check whether LSP server supports getting document symbol information
   if !lspserver.isDocumentSymbolProvider
-    util.ErrMsg("Error: LSP server does not support getting list of symbols")
+    util.ErrMsg('Error: LSP server does not support getting list of symbols')
     return
   endif
 
@@ -1125,7 +1125,7 @@ def TextDocFormat(lspserver: dict<any>, fname: string, rangeFormat: bool,
                                start_lnum: number, end_lnum: number)
   # Check whether LSP server supports formatting documents
   if !lspserver.isDocumentFormattingProvider
-    util.ErrMsg("Error: LSP server does not support formatting documents")
+    util.ErrMsg('Error: LSP server does not support formatting documents')
     return
   endif
 
@@ -1207,7 +1207,7 @@ enddef
 def IncomingCalls(lspserver: dict<any>, fname: string)
   # Check whether LSP server supports call hierarchy
   if !lspserver.isCallHierarchyProvider
-    util.ErrMsg("Error: LSP server does not support call hierarchy")
+    util.ErrMsg('Error: LSP server does not support call hierarchy')
     return
   endif
 
@@ -1230,7 +1230,7 @@ enddef
 def OutgoingCalls(lspserver: dict<any>, fname: string)
   # Check whether LSP server supports call hierarchy
   if !lspserver.isCallHierarchyProvider
-    util.ErrMsg("Error: LSP server does not support call hierarchy")
+    util.ErrMsg('Error: LSP server does not support call hierarchy')
     return
   endif
 
@@ -1254,7 +1254,7 @@ enddef
 def InlayHintsShow(lspserver: dict<any>)
   # Check whether LSP server supports type hierarchy
   if !lspserver.isInlayHintProvider && !lspserver.isClangdInlayHintsProvider
-    util.ErrMsg("Error: LSP server does not support inlay hint")
+    util.ErrMsg('Error: LSP server does not support inlay hint')
     return
   endif
 
@@ -1285,7 +1285,7 @@ enddef
 def TypeHiearchy(lspserver: dict<any>, direction: number)
   # Check whether LSP server supports type hierarchy
   if !lspserver.isTypeHierarchyProvider
-    util.ErrMsg("Error: LSP server does not support type hierarchy")
+    util.ErrMsg('Error: LSP server does not support type hierarchy')
     return
   endif
 
@@ -1310,7 +1310,7 @@ enddef
 def RenameSymbol(lspserver: dict<any>, newName: string)
   # Check whether LSP server supports rename operation
   if !lspserver.isRenameProvider
-    util.ErrMsg("Error: LSP server does not support rename operation")
+    util.ErrMsg('Error: LSP server does not support rename operation')
     return
   endif
 
@@ -1338,7 +1338,7 @@ def CodeAction(lspserver: dict<any>, fname_arg: string, line1: number,
                line2: number, query: string)
   # Check whether LSP server supports code action operation
   if !lspserver.isCodeActionProvider
-    util.ErrMsg("Error: LSP server does not support code action operation")
+    util.ErrMsg('Error: LSP server does not support code action operation')
     return
   endif
 
@@ -1377,7 +1377,7 @@ enddef
 def WorkspaceQuerySymbols(lspserver: dict<any>, query: string)
   # Check whether the LSP server supports listing workspace symbols
   if !lspserver.isWorkspaceSymbolProvider
-    util.ErrMsg("Error: LSP server does not support listing workspace symbols")
+    util.ErrMsg('Error: LSP server does not support listing workspace symbols')
     return
   endif
 
@@ -1446,7 +1446,7 @@ enddef
 def SelectionRange(lspserver: dict<any>, fname: string)
   # Check whether LSP server supports selection ranges
   if !lspserver.isSelectionRangeProvider
-    util.ErrMsg("Error: LSP server does not support selection ranges")
+    util.ErrMsg('Error: LSP server does not support selection ranges')
     return
   endif
 
@@ -1472,7 +1472,7 @@ enddef
 def SelectionExpand(lspserver: dict<any>)
   # Check whether LSP server supports selection ranges
   if !lspserver.isSelectionRangeProvider
-    util.ErrMsg("Error: LSP server does not support selection ranges")
+    util.ErrMsg('Error: LSP server does not support selection ranges')
     return
   endif
 
@@ -1483,7 +1483,7 @@ enddef
 def SelectionShrink(lspserver: dict<any>)
   # Check whether LSP server supports selection ranges
   if !lspserver.isSelectionRangeProvider
-    util.ErrMsg("Error: LSP server does not support selection ranges")
+    util.ErrMsg('Error: LSP server does not support selection ranges')
     return
   endif
 
@@ -1496,7 +1496,7 @@ enddef
 def FoldRange(lspserver: dict<any>, fname: string)
   # Check whether LSP server supports fold ranges
   if !lspserver.isFoldingRangeProvider
-    util.ErrMsg("Error: LSP server does not support folding")
+    util.ErrMsg('Error: LSP server does not support folding')
     return
   endif
 
index 0c8f7d10fcd17e82f62fc8e9b8162cf48367fe06..7c0ca0f32ac198837c755432f023f204856702ed 100644 (file)
@@ -194,7 +194,7 @@ enddef
 
 def GetNextInlineBlock(text: string, blocks: list<any>, rel_pos: number): dict<any>
   var result = {
-    text: "",
+    text: '',
     props: []
   }
   var cur = blocks->remove(0)
@@ -227,7 +227,7 @@ enddef
 
 def ParseInlines(text: string, rel_pos: number = 0): dict<any>
   var formatted = {
-    text: "",
+    text: '',
     props: []
   }
   var code_spans = GetCodeSpans(text)
@@ -341,13 +341,13 @@ enddef
 def CreateContainerBlock(match: list<any>, start_lnum: number): dict<any>
   if match[0][0] == '>'
     return {
-      type: "quote_block",
+      type: 'quote_block',
       lnum: start_lnum,
       indent: 0
     }
   else
     return {
-      type: "list_item",
+      type: 'list_item',
       lnum: start_lnum,
       marker: $' {match[0]->matchstr("\\S\\+")} ',
       indent: match[2]
@@ -357,7 +357,7 @@ enddef
 
 # new open leaf block
 def CreateLeafBlock(block_type: string, line: string, ...opt: list<any>): dict<any>
-  if block_type == "fenced_code"
+  if block_type == 'fenced_code'
     var token = line->matchlist(code_fence)
     return {
       type: block_type,
@@ -365,23 +365,23 @@ def CreateLeafBlock(block_type: string, line: string, ...opt: list<any>): dict<a
       language: token[2],
       text: []
     }
-  elseif block_type == "indented_code"
+  elseif block_type == 'indented_code'
     return {
       type: block_type,
       text: [line->matchstr(code_indent)]
     }
-  elseif block_type == "paragraph"
+  elseif block_type == 'paragraph'
     return {
       type: block_type,
       text: [line->matchstr(paragraph)]
     }
-  elseif block_type == "heading"
+  elseif block_type == 'heading'
     return {
       type: block_type,
       level: opt[0],
       text: line
     }
-  elseif block_type == "table"
+  elseif block_type == 'table'
     return {
       type: block_type,
       header: line,
@@ -393,11 +393,11 @@ def CreateLeafBlock(block_type: string, line: string, ...opt: list<any>): dict<a
 enddef
 
 def NeedBlankLine(prev: string, cur: string): bool
-  if prev == "hr" || cur == "hr"
+  if prev == 'hr' || cur == 'hr'
     return v:false
-  elseif prev == "heading" || cur == "heading"
+  elseif prev == 'heading' || cur == 'heading'
     return v:true
-  elseif prev == "paragraph" && cur == "paragraph"
+  elseif prev == 'paragraph' && cur == 'paragraph'
     return v:true
   elseif prev != cur
     return v:true
@@ -405,23 +405,23 @@ def NeedBlankLine(prev: string, cur: string): bool
   return v:false
 enddef
 
-var last_block: string = ""
+var last_block: string = ''
 
 def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: number = 0): void
   if start >= blocks->len()
     return
   endif
   var line: dict<any> = {
-    text: "",
+    text: '',
     props: []
   }
   if !document.content->empty() && NeedBlankLine(last_block, blocks[0].type)
-    document.content->add({text: "", props: []})
+    document.content->add({text: '', props: []})
   endif
   last_block = blocks[0].type
 
   for i in start->range()
-    if blocks[i]->has_key("marker")
+    if blocks[i]->has_key('marker')
       if blocks[i].marker =~ '\S'
        line.props->add(GetMarkerProp('list_item',
                                      line.text->len() + 1,
@@ -435,7 +435,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
   endfor
   for block in blocks->remove(start, -1)
     if block.type =~ 'quote_block\|list_item'
-      if block->has_key("marker")
+      if block->has_key('marker')
        if block.marker =~ '\S'
          line.props->add(GetMarkerProp('list_item',
                                        line.text->len() + 1,
@@ -449,7 +449,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
     else
       # leaf block
       if block.type =~ '_code'
-       if block.type == "indented_code"
+       if block.type == 'indented_code'
          while !block.text->empty() && block.text[0] !~ '\S'
            block.text->remove(0)
          endwhile
@@ -479,7 +479,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
                                          indent->len() + max_len + 1))
          endif
        endif
-      elseif block.type == "heading"
+      elseif block.type == 'heading'
        line.props->add(GetMarkerProp('heading',
                                      line.text->len() + 1,
                                      block.text->len(),
@@ -488,7 +488,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
        line.text ..= format.text
        line.props += line.props
        document.content->add(line)
-      elseif block.type == "table"
+      elseif block.type == 'table'
        var indent = line.text
        var head = block.header->split('\\\@1<!|')
        var col1 = head->remove(0)
@@ -504,7 +504,7 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
          line.props->add(GetMarkerProp('table_header',
                                        line.text->len() + 2,
                                        format.text->len()))
-         line.text ..= "|" .. format.text
+         line.text ..= $'|{format.text}'
          line.props += format.props
        endfor
        document.content->add(line)
@@ -530,13 +530,13 @@ def CloseBlocks(document: dict<list<any>>, blocks: list<dict<any>>, start: numbe
            data.props->add(GetMarkerProp('table_sep',
                                          data.text->len() + 1,
                                          1))
-           data.text ..= "|" .. format.text
+           data.text ..= $'|{format.text}'
            data.props += format.props
          endfor
          document.content->add(data)
        endfor
-      elseif block.type == "paragraph"
-       var format = ParseInlines(block.text->join(" "), line.text->len())
+      elseif block.type == 'paragraph'
+       var format = ParseInlines(block.text->join(' '), line.text->len())
        line.text ..= format.text
        line.props += format.props
        document.content->add(line)
@@ -555,19 +555,19 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
 
     # for each open block check if current line continue it
     while cur < open_blocks->len()
-      if open_blocks[cur].type == "quote_block"
+      if open_blocks[cur].type == 'quote_block'
        var marker = line->matchstrpos(block_quote)
        if marker[1] == -1
          break
        endif
        line = line[marker[2] :]
-      elseif open_blocks[cur].type == "list_item"
+      elseif open_blocks[cur].type == 'list_item'
        var marker = line->matchstrpos($'^ \{{{open_blocks[cur].indent}}}')
        if marker[1] == -1
          break
        endif
        line = line[marker[2] :]
-      elseif open_blocks[cur].type == "fenced_code"
+      elseif open_blocks[cur].type == 'fenced_code'
        if line =~ $'^ \{{,3}}{open_blocks[cur].fence}{open_blocks[cur].fence[0]}* *$'
          CloseBlocks(document, open_blocks, cur)
        else
@@ -575,19 +575,19 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
        endif
        cur = -1
        break
-      elseif open_blocks[cur].type == "indented_code"
+      elseif open_blocks[cur].type == 'indented_code'
        var marker = line->matchstrpos(code_indent)
        if marker[1] >= 0
          open_blocks[cur].text->add(marker[0])
          cur = -1
        endif
        break
-      elseif open_blocks[cur].type == "paragraph"
+      elseif open_blocks[cur].type == 'paragraph'
        if line =~ setext_heading
          var marker = line->matchstrpos(setext_heading)
          open_blocks->add(CreateLeafBlock(
-                                 "heading",
-                                 open_blocks->remove(cur).text->join(" "),
+                                 'heading',
+                                 open_blocks->remove(cur).text->join(' '),
                                  setext_heading_level[marker[0]]))
          CloseBlocks(document, open_blocks, cur)
          cur = -1
@@ -595,9 +595,9 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
          # may be a table
          var marker = line->matchstr(table_delimiter)
          if !marker->empty()
-           if open_blocks[cur].text[0]->split('\\\@1<!|')->len() == marker->split("|")->len()
+           if open_blocks[cur].text[0]->split('\\\@1<!|')->len() == marker->split('|')->len()
              open_blocks->add(CreateLeafBlock(
-                                 "table",
+                                 'table',
                                  open_blocks->remove(cur).text[0],
                                  marker))
              cur = -1
@@ -617,12 +617,12 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
     # a themaic break close all previous blocks
     if line =~ thematic_break
       CloseBlocks(document, open_blocks)
-      if &g:encoding == "utf-8"
+      if &g:encoding == 'utf-8'
        document.content->add({text: "\u2500"->repeat(width)})
       else
-       document.content->add({text: "-"->repeat(width)})
+       document.content->add({text: '-'->repeat(width)})
       endif
-      last_block = "hr"
+      last_block = 'hr'
       continue
     endif
 
@@ -643,45 +643,45 @@ export def ParseMarkdown(data: list<string>, width: number = 80): dict<list<any>
     # check for leaf block
     if line =~ code_fence
       CloseBlocks(document, open_blocks, cur)
-      open_blocks->add(CreateLeafBlock("fenced_code", line))
+      open_blocks->add(CreateLeafBlock('fenced_code', line))
     elseif line =~ blank_line
       if open_blocks->empty()
        continue
       endif
-      if open_blocks[-1].type == "paragraph"
+      if open_blocks[-1].type == 'paragraph'
        CloseBlocks(document, open_blocks, min([cur, open_blocks->len() - 1]))
-      elseif open_blocks[-1].type == "table"
+      elseif open_blocks[-1].type == 'table'
        CloseBlocks(document, open_blocks, open_blocks->len() - 1)
       elseif open_blocks[-1].type =~ '_code'
        open_blocks[-1].text->add(line)
       endif
     elseif line =~ code_indent
       if open_blocks->empty()
-       open_blocks->add(CreateLeafBlock("indented_code", line))
+       open_blocks->add(CreateLeafBlock('indented_code', line))
       elseif open_blocks[-1].type =~ '_code'
        open_blocks[-1].text->add(line->matchstr(code_indent))
-      elseif open_blocks[-1].type == "paragraph"
+      elseif open_blocks[-1].type == 'paragraph'
        open_blocks[-1].text->add(line->matchstr(paragraph))
       else
         CloseBlocks(document, open_blocks, cur)
-       open_blocks->add(CreateLeafBlock("indented_code", line))
+       open_blocks->add(CreateLeafBlock('indented_code', line))
       endif
     elseif line =~ atx_heading
       CloseBlocks(document, open_blocks, cur)
       var token = line->matchlist(atx_heading)
-      open_blocks->add(CreateLeafBlock("heading", token[2], token[1]->len()))
+      open_blocks->add(CreateLeafBlock('heading', token[2], token[1]->len()))
       CloseBlocks(document, open_blocks, cur)
     elseif !open_blocks->empty()
-      if open_blocks[-1].type == "table"
+      if open_blocks[-1].type == 'table'
        open_blocks[-1].text->add(line)
-      elseif open_blocks[-1].type == "paragraph"
+      elseif open_blocks[-1].type == 'paragraph'
        open_blocks[-1].text->add(line->matchstr(paragraph))
       else
         CloseBlocks(document, open_blocks, cur)
-        open_blocks->add(CreateLeafBlock("paragraph", line))
+        open_blocks->add(CreateLeafBlock('paragraph', line))
       endif
     else
-      open_blocks->add(CreateLeafBlock("paragraph", line))
+      open_blocks->add(CreateLeafBlock('paragraph', line))
     endif
   endfor
 
index 8ee1a9b376280b280e6daf3e7e1963188ed41365..51467f18fb24ff0e52471d3889c64d9404150a57 100644 (file)
@@ -66,8 +66,8 @@ export def SelectionModify(lspserver: dict<any>, expand: bool)
     # reply for this buffer is available. Modify the current selection.
 
     var selRange: dict<any> = lspserver.selection.selRange
-    var startpos: list<number> = getcharpos("v")
-    var endpos: list<number> = getcharpos(".")
+    var startpos: list<number> = getcharpos('v')
+    var endpos: list<number> = getcharpos('.')
     var idx: number = lspserver.selection.index
 
     # Locate the range in the LSP reply for the current selection
index 6bddbff4c313d4c707be73c9587b731017e08cca..89e498f21a3d82c4dad35bdf7c98dc90a493290a 100644 (file)
@@ -138,7 +138,7 @@ def ShowSymbolMenu(lspserver: dict<any>, query: string)
       maxwidth: 60,
       mapping: false,
       fixed: 1,
-      close: "button",
+      close: 'button',
       filter: function(FilterSymbols, [lspserver]),
       callback: JumpToWorkspaceSymbol
   }
index 061e8f97bd56748f456cf6b0631dde3a06d62090..257ec53c77e2841a35e30441db43bf4c26ffb341 100644 (file)
@@ -43,9 +43,9 @@ def Set_lines(lines: list<string>, A: list<number>, B: list<number>,
     #util.WarnMsg("set_lines: Invalid range, A = " .. A->string()
     #          .. ", B = " ..  B->string() .. ", numlines = " .. numlines
     #          .. ", new lines = " .. new_lines->string())
-    var msg = "set_lines: Invalid range, A = " .. A->string()
-    msg ..= ", B = " ..  B->string() .. ", numlines = " .. numlines
-    msg ..= ", new lines = " .. new_lines->string()
+    var msg = $"set_lines: Invalid range, A = {A->string()}"
+    msg ..= $", B = {B->string()}, numlines = {numlines}"
+    msg ..= $", new lines = {new_lines->string()}"
     util.WarnMsg(msg)
     return lines
   endif
@@ -59,7 +59,7 @@ def Set_lines(lines: list<string>, A: list<number>, B: list<number>,
 
   var new_lines_len: number = new_lines->len()
 
-  #echomsg 'i_0 = ' .. i_0 .. ', i_n = ' .. i_n .. ', new_lines = ' .. string(new_lines)
+  #echomsg $"i_0 = {i_0}, i_n = {i_n}, new_lines = {string(new_lines)}"
   var n: number = i_n - i_0 + 1
   if n != new_lines_len
     if n > new_lines_len
@@ -71,26 +71,26 @@ def Set_lines(lines: list<string>, A: list<number>, B: list<number>,
       lines->extend(repeat([''], new_lines_len - n), i_0)
     endif
   endif
-  #echomsg "lines(1) = " .. string(lines)
+  #echomsg $"lines(1) = {string(lines)}"
 
   # replace the previous lines with the new lines
   for i in new_lines_len->range()
     lines[i_0 + i] = new_lines[i]
   endfor
-  #echomsg "lines(2) = " .. string(lines)
+  #echomsg $"lines(2) = {string(lines)}"
 
   # append the suffix (if any) to the last line
   if suffix != ''
     var i = i_0 + new_lines_len - 1
     lines[i] = lines[i] .. suffix
   endif
-  #echomsg "lines(3) = " .. string(lines)
+  #echomsg $"lines(3) = {string(lines)}"
 
   # prepend the prefix (if any) to the first line
   if prefix != ''
     lines[i_0] = prefix .. lines[i_0]
   endif
-  #echomsg "lines(4) = " .. string(lines)
+  #echomsg $"lines(4) = {string(lines)}"
 
   return lines
 enddef
@@ -142,7 +142,7 @@ export def ApplyTextEdits(bnr: number, text_edits: list<dict<any>>): void
     lines->add('')
   endif
 
-  #echomsg 'lines(1) = ' .. string(lines)
+  #echomsg $'lines(1) = {string(lines)}'
   #echomsg updated_edits
 
   for e in updated_edits
@@ -151,15 +151,15 @@ export def ApplyTextEdits(bnr: number, text_edits: list<dict<any>>): void
     lines = Set_lines(lines, A, B, e.lines)
   endfor
 
-  #echomsg 'lines(2) = ' .. string(lines)
+  #echomsg $'lines(2) = {string(lines)}'
 
   # If the last line is empty and we need to set EOL, then remove it.
   if set_eol && lines[-1]->len() == 0
     lines->remove(-1)
   endif
 
-  #echomsg 'ApplyTextEdits: start_line = ' .. start_line .. ', finish_line = ' .. finish_line
-  #echomsg 'lines = ' .. string(lines)
+  #echomsg $'ApplyTextEdits: start_line = {start_line}, finish_line = {finish_line}'
+  #echomsg $'lines = {string(lines)}'
 
   # Delete all the lines that need to be modified
   bnr->deletebufline(start_line + 1, finish_line + 1)
index 510a4463cf984b46a1ecd3dc1fbd19c04b208bfd..d4048e67ca5599b5b2399fcce019f46e5b85a2ab 100644 (file)
@@ -50,7 +50,7 @@ def TypeTreeGenerate(super: bool, typeHier: dict<any>, pfx_arg: string,
   items = super ? typeHier.parents : typeHier.children
 
   for item in items
-    TypeTreeGenerate(super, item, pfx_arg .. '| ', typeTree, typeUriMap)
+    TypeTreeGenerate(super, item, $'{pfx_arg}| ', typeTree, typeUriMap)
   endfor
 enddef