]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Not able to use one exported function from another exported function in an autoloaded...
authorYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 11 Jan 2022 15:20:13 +0000 (07:20 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 11 Jan 2022 15:20:13 +0000 (07:20 -0800)
autoload/diag.vim
autoload/util.vim

index d870422ee7740530832e1cea2926f1abb6979159..687c4865384bb99380899c8a50f741bdc85c7952 100644 (file)
@@ -10,6 +10,7 @@ if has('patch-8.2.4019')
   opt.lspOptions = opt_import.lspOptions
   util.WarnMsg = util_import.WarnMsg
   util.GetLineByteFromPos = util_import.GetLineByteFromPos
+  util.LspUriToFile = util_import.LspUriToFile
 else
   import lspOptions from './lspoptions.vim'
   import {WarnMsg,
@@ -40,7 +41,7 @@ enddef
 
 # New LSP diagnostic messages received from the server for a file.
 # Update the signs placed in the buffer for this file
-export def UpdateDiags(lspserver: dict<any>, bnr: number)
+def ProcessNewDiags(lspserver: dict<any>, bnr: number)
   if !opt.lspOptions.autoHighlightDiags
     return
   endif
@@ -74,6 +75,14 @@ export def UpdateDiags(lspserver: dict<any>, bnr: number)
   signs->sign_placelist()
 enddef
 
+# FIXME: Remove this function once the Vim bug (calling one exported function
+# from another exported function in an autoload script is not working) is
+# fixed. Replace the calls to this function directly with calls to
+# ProcessNewDiags().
+export def UpdateDiags(lspserver: dict<any>, bnr: number)
+  ProcessNewDiags(lspserver, bnr)
+enddef
+
 # process a diagnostic notification message from the LSP server
 # Notification: textDocument/publishDiagnostics
 # Param: PublishDiagnosticsParams
@@ -101,7 +110,7 @@ export def DiagNotification(lspserver: dict<any>, uri: string, diags: list<dict<
   endfor
 
   lspserver.diagsMap->extend({['' .. bnr]: diag_by_lnum})
-  UpdateDiags(lspserver, bnr)
+  ProcessNewDiags(lspserver, bnr)
 enddef
 
 # get the count of error in the current buffer
index bed2f381a65a5f1ef5ca1c7c68aec027b1657519..e815e22cd5e0f05bfab8a2f3c78d0d5af3eb3d9a 100644 (file)
@@ -70,7 +70,7 @@ export def LspUriToFile(uri: string): string
 enddef
 
 # Convert a Vim filename to an LSP URI (file://<absolute_path>)
-export def LspFileToUri(fname: string): string
+def ConvertFilenameToUri(fname: string): string
   var uri: string = fnamemodify(fname, ':p')
 
   var on_windows: bool = false
@@ -95,9 +95,17 @@ export def LspFileToUri(fname: string): string
   return uri
 enddef
 
+# FIXME: Remove this function once the Vim bug (calling one exported function
+# from another exported function in an autoload script is not working) is
+# fixed. Replace the calls to this function directly with calls to
+# ConvertFilenameToUri().
+export def LspFileToUri(fname: string): string
+  return ConvertFilenameToUri(fname)
+enddef
+
 # Convert a Vim buffer number to an LSP URI (file://<absolute_path>)
 export def LspBufnrToUri(bnr: number): string
-  return LspFileToUri(bnr->bufname())
+  return ConvertFilenameToUri(bnr->bufname())
 enddef
 
 # Returns the byte number of the specified LSP position in buffer 'bnr'.