# New LSP diagnostic messages received from the server for a file.
# Update the signs placed in the buffer for this file
-def ProcessNewDiags(lspserver: dict<any>, bnr: number)
+export def ProcessNewDiags(lspserver: dict<any>, bnr: number)
if opt.lspOptions.autoPopulateDiags
DiagsUpdateLocList(lspserver, bnr)
endif
DiagsRefreshSigns(lspserver, bnr)
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
if lspserver->empty() || !lspserver.running
return
endif
- diag.UpdateDiags(lspserver, bnr)
+ diag.ProcessNewDiags(lspserver, bnr)
enddef
# Add buffer-local autocmds when attaching a LSP server to a buffer
# Notification: 'textDocument/didSave'
# Params: DidSaveTextDocumentParams
var params = {textDocument: {uri: util.LspBufnrToUri(bnr)}}
- # FIXME: should concern 'params.text' on
- # 'lspserver.caps.textDocumentSync.save.includeText' too?
+ # FIXME: Need to set "params.text" when
+ # 'lspserver.caps.textDocumentSync.save.includeText' is set to true.
lspserver.sendNotification('textDocument/didSave', params)
enddef
enddef
# Convert a Vim filename to an LSP URI (file://<absolute_path>)
-def ConvertFilenameToUri(fname: string): string
+export def LspFileToUri(fname: string): string
var uri: string = fname->fnamemodify(':p')
var on_windows: bool = false
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 ConvertFilenameToUri(bnr->bufname())
+ return LspFileToUri(bnr->bufname())
enddef
# Returns the byte number of the specified LSP position in buffer 'bnr'.