# Explicitly ignored requests
var lspIgnoredRequestHandlers: list<string> =
[
- # Eclipse java language server sends the 'workspace/executeClientCommand'
- # request (to reload bundles) which is not in the LSP specification.
+ # Eclipse java language server sends the
+ # 'workspace/executeClientCommand' request (to reload bundles) which is
+ # not in the LSP specification.
'workspace/executeClientCommand',
]
endif
continue
endif
- var args: list<string> = []
if server->has_key('args')
if server.args->type() != v:t_list
util.ErrMsg($'Arguments for LSP server {server.args} is not a List')
continue
endif
- args = server.args
+ else
+ server.args = []
endif
- var initializationOptions: dict<any> = {}
- if server->has_key('initializationOptions')
- initializationOptions = server.initializationOptions
+ if !server->has_key('initializationOptions')
+ || server.initializationOptions->type() != v:t_dict
+ server.initializationOptions = {}
endif
- var customNotificationHandlers: dict<func> = {}
- if server->has_key('customNotificationHandlers')
- customNotificationHandlers = server.customNotificationHandlers
+ if !server->has_key('customNotificationHandlers')
+ || server.customNotificationHandlers->type() != v:t_dict
+ 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')
continue
endif
- ProcessDiagHandler = server.processDiagHandler
+ else
+ server.processDiagHandler = null_function
endif
- var customRequestHandlers: dict<func> = {}
- if server->has_key('customRequestHandlers')
- customRequestHandlers = server.customRequestHandlers
+ if !server->has_key('customRequestHandlers')
+ || server.customRequestHandlers->type() != v:t_dict
+ server.customRequestHandlers = {}
endif
- var features: dict<bool> = {}
- if server->has_key('features')
- features = server.features
+ if !server->has_key('features') || server.features->type() != v:t_dict
+ server.features = {}
endif
if server.omnicompl->type() != v:t_bool
endif
if !server->has_key('name') || server.name->type() != v:t_string
- || server.name->empty()
+ || server.name->empty()
# Use the executable name (without the extension) as the language server
# name.
server.name = server.path->fnamemodify(':t:r')
server.debug = false
endif
+ if !server->has_key('traceLevel')
+ || server->type() != v:t_string
+ || (server.traceLevel != 'off' && server.traceLevel != 'debug'
+ && server.traceLevel != 'verbose')
+ server.traceLevel = 'off'
+ endif
+
if !server->has_key('workspaceConfig')
+ || server.workspaceConfig->type() != v:t_dict
server.workspaceConfig = {}
endif
server.rootSearch = []
endif
- if !server->has_key('runIfSearch') || server.runIfSearch->type() != v:t_list
+ if !server->has_key('runIfSearch') ||
+ server.runIfSearch->type() != v:t_list
server.runIfSearch = []
endif
- if !server->has_key('runUnlessSearch') || server.runUnlessSearch->type() != v:t_list
+ if !server->has_key('runUnlessSearch') ||
+ server.runUnlessSearch->type() != v:t_list
server.runUnlessSearch = []
endif
- var lspserver: dict<any> = lserver.NewLspServer(server.name, server.path,
- args, server.syncInit,
- initializationOptions,
- server.workspaceConfig,
- server.rootSearch,
- server.runIfSearch,
- server.runUnlessSearch,
- customNotificationHandlers,
- customRequestHandlers,
- ProcessDiagHandler,
- features, server.debug)
+ var lspserver: dict<any> = lserver.NewLspServer(server)
var ftypes = server.filetype
if ftypes->type() == v:t_string
exe $'doautocmd <nomodeline> User LspServerReady_{lspserver.id}'
endif
+ # set the server debug trace level
+ if lspserver.traceLevel != 'off'
+ lspserver.setTrace(lspserver.traceLevel)
+ endif
+
# if the outline window is opened, then request the symbols for the current
# buffer
if bufwinid('LSP-Outline') != -1
return UniqueServerIdCounter
enddef
-export def NewLspServer(name_arg: string, path_arg: string, args: list<string>,
- isSync: bool, initializationOptions: any,
- workspaceConfig: dict<any>,
- rootSearchFiles: list<any>,
- runIfSearchFiles: list<any>,
- runUnlessSearchFiles: list<any>,
- customNotificationHandlers: dict<func>,
- customRequestHandlers: dict<func>,
- ProcessDiagHandler: func,
- features: dict<bool>, debug_arg: bool): dict<any>
+export def NewLspServer(serverParams: dict<any>): dict<any>
var lspserver: dict<any> = {
id: GetUniqueServerId(),
- name: name_arg,
- path: path_arg,
- args: args,
- syncInit: isSync,
- initializationOptions: initializationOptions,
- customNotificationHandlers: customNotificationHandlers,
- customRequestHandlers: customRequestHandlers,
- processDiagHandler: ProcessDiagHandler,
- features: features,
+ name: serverParams.name,
+ path: serverParams.path,
+ args: serverParams.args->deepcopy(),
+ syncInit: serverParams.syncInit,
+ initializationOptions: serverParams.initializationOptions->deepcopy(),
+ customNotificationHandlers: serverParams.customNotificationHandlers->deepcopy(),
+ customRequestHandlers: serverParams.customRequestHandlers->deepcopy(),
+ processDiagHandler: serverParams.processDiagHandler,
+ features: serverParams.features->deepcopy(),
running: false,
ready: false,
job: v:none,
nextID: 1,
caps: {},
requests: {},
- rootSearchFiles: rootSearchFiles,
- runIfSearchFiles: runIfSearchFiles,
- runUnlessSearchFiles: runUnlessSearchFiles,
+ rootSearchFiles: serverParams.rootSearch->deepcopy(),
+ runIfSearchFiles: serverParams.runIfSearch->deepcopy(),
+ runUnlessSearchFiles: serverParams.runUnlessSearch->deepcopy(),
omniCompletePending: false,
completionTriggerChars: [],
signaturePopup: -1,
peekSymbolFilePopup: -1,
callHierarchyType: '',
selection: {},
- workspaceConfig: workspaceConfig,
+ workspaceConfig: serverParams.workspaceConfig->deepcopy(),
messages: [],
- debug: debug_arg
+ debug: serverParams.debug,
+ traceLevel: serverParams.traceLevel
}
lspserver.logfile = $'lsp-{lspserver.name}.log'
lspserver.errfile = $'lsp-{lspserver.name}.err'
debugging a language server. By default the
messages are not logged. See |lsp-debug| for more
information.
+ *lsp-cfg-traceLevel*
+ traceLevel (Optional) set the debug trace level for this language
+ server. Supported values are: "off", "debug" and
+ "verbose". By default this is seto "off".
The language servers are added using the LspAddServer() function. This
function accepts a list of language servers with the above information.