# process a diagnostic notification message from the LSP server
# Notification: textDocument/publishDiagnostics
# Param: PublishDiagnosticsParams
-export def DiagNotification(lspserver: dict<any>, uri: string, newDiags: list<dict<any>>): void
+export def DiagNotification(lspserver: dict<any>, uri: string, diags_arg: list<dict<any>>): void
# Diagnostics are disabled for this server
if lspserver.features->has_key('diagnostics') && !lspserver.features.diagnostics
return
return
endif
+ var newDiags: list<dict<any>> = diags_arg
+ if lspserver.processDiagHandler != null_function
+ newDiags = lspserver.processDiagHandler(diags_arg)
+ endif
+
# TODO: Is the buffer (bnr) always a loaded buffer? Should we load it here?
var lastlnum: number = bnr->getbufinfo()[0].linecount
customNotificationHandlers = server.customNotificationHandlers
endif
+ var ProcessDiagHandler: func = null_function
+ if server->has_key('processDiagHandler')
+ ProcessDiagHandler = server.processDiagHandler
+ endif
+
var features: dict<bool> = {}
if server->has_key('features')
features = server.features
server.runIfSearch,
server.runUnlessSearch,
customNotificationHandlers,
+ ProcessDiagHandler,
features, server.debug)
var ftypes = server.filetype
runIfSearchFiles: list<any>,
runUnlessSearchFiles: list<any>,
customNotificationHandlers: dict<func>,
+ ProcessDiagHandler: func,
features: dict<bool>, debug_arg: bool): dict<any>
var lspserver: dict<any> = {
id: GetUniqueServerId(),
syncInit: isSync,
initializationOptions: initializationOptions,
customNotificationHandlers: customNotificationHandlers,
+ processDiagHandler: ProcessDiagHandler,
features: features,
running: false,
ready: false,
omnicompl (Optional) a boolean value that enables (true)
or disables (false) omni-completion for this file
types. By default this is set to "v:true".
+ *lsp-cfg-processDiagHandler*
+ processDiagHandler
+ (Optional) A |Funcref| or |lambda| that takes a list of
+ language server diagnostics and returns a new list of
+ filtered, or otherwise changed diagnostics. Can be used
+ to remove unwanted diagnostics, prefix the diagnostics
+ text, etc.
*lsp-cfg-syncInit*
syncInit (Optional) for language servers (e.g. rust analyzer,
gopls, etc.) that take time to initialize and reply to