customNotificationHandlers = server.customNotificationHandlers
endif
-
+ var ProcessDiagHandler: func = null_function
+ if server->has_key('processDiagHandler')
+ if server.processDiagHandler->type() != v:t_func
+ util.ErrMsg($'Setting of processDiagHandler {server.processDiagHandler} is not a Funcref nor lambda')
+ return
+ endif
+ ProcessDiagHandler = server.processDiagHandler
+ endif
+
+ var customRequestHandlers: dict<func> = {}
+ if server->has_key('customRequestHandlers')
+ customRequestHandlers = server.customRequestHandlers
+ endif
+
var features: dict<bool> = {}
if server->has_key('features')
features = server.features
server.runIfSearch,
server.runUnlessSearch,
customNotificationHandlers,
- ProcessDiagHandler,
+ customRequestHandlers,
++ ProcessDiagHandler,
features, server.debug)
var ftypes = server.filetype
runIfSearchFiles: list<any>,
runUnlessSearchFiles: list<any>,
customNotificationHandlers: dict<func>,
- ProcessDiagHandler: func,
+ customRequestHandlers: dict<func>,
++ ProcessDiagHandler: func,
features: dict<bool>, debug_arg: bool): dict<any>
var lspserver: dict<any> = {
id: GetUniqueServerId(),
syncInit: isSync,
initializationOptions: initializationOptions,
customNotificationHandlers: customNotificationHandlers,
+ customRequestHandlers: customRequestHandlers,
+ processDiagHandler: ProcessDiagHandler,
features: features,
running: false,
ready: false,
|lsp-features| for more information.
*lsp-cfg-omnicompl*
omnicompl (Optional) a boolean value that enables (true)
-- or disables (false) omni-completion for this file
- types. By default this is set to "true".
++ or disables (false) omni-completion for these 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. The following example will remove all but
+ errors and warnings: >
+
+ vim9script
+ g:LspAddServer([{
+ filetype: ['javascript', 'typescript'],
+ path: '/usr/local/bin/typescript-language-server',
+ args: ['--stdio'],
+ processDiagHandler: (diags: list<dict<any>>) => {
+ # Only include errors and warnings
+ return diags->filter((diag, ix) => {
+ return diag.severity <= 2
+ })
+ },
+ }])
+<
+ And this example will prefix the diagnostic message with
+ the string "TypeScript: ": >
+
+ vim9script
+ g:LspAddServer([{
+ filetype: ['javascript', 'typescript'],
+ path: '/usr/local/bin/typescript-language-server',
+ args: ['--stdio'],
+ processDiagHandler: (diags: list<dict<any>>) => {
+ return diags->map((diag, ix) => {
+ diag.message = $'TypeScript: {diag.message}'
+ return diag
+ })
+ },
+ }])
+<
*lsp-cfg-syncInit*
syncInit (Optional) for language servers (e.g. rust analyzer,
gopls, etc.) that take time to initialize and reply to