args|a list of command-line arguments passed to the LSP server. Each argument is a separate List item.
initializationOptions|User provided initialization options. May be of any type. For example the *intelephense* PHP language server accept several options here with the License Key among others.
customNotificationHandlers|A dictionary of notifications and functions that can be specified to add support for custom language server notifications.
+customRequestHandlers|A dictionary of request handlers and functions that can be specified to add support for custom language server requests replies.
features|A dictionary of booleans that can be specified to toggle what things a given LSP is providing (folding, goto definition, etc) This is useful when running multiple servers in one buffer.
The LspAddServer() function accepts a list of LSP servers with the above information.
lspserver.sendResponse(request, {}, {})
enddef
-def ProcessUnsupportedReq(lspserver: dict<any>, request: dict<any>)
- util.ErrMsg($'Unsupported request message received from the LSP server ({lspserver.path}), message = {request->string()}')
-enddef
-
# process a request message from the server
export def ProcessRequest(lspserver: dict<any>, request: dict<any>)
var lspRequestHandlers: dict<func> =
'window/workDoneProgress/create': ProcessWorkDoneProgressCreate,
'client/registerCapability': ProcessClientRegisterCap,
'client/unregisterCapability': ProcessClientUnregisterCap,
- 'workspace/configuration': ProcessWorkspaceConfiguration,
- 'workspace/codeLens/refresh': ProcessUnsupportedReq,
- 'workspace/semanticTokens/refresh': ProcessUnsupportedReq
+ 'workspace/configuration': ProcessWorkspaceConfiguration
}
if lspRequestHandlers->has_key(request.method)
lspRequestHandlers[request.method](lspserver, request)
+ elseif lspserver.customRequestHandlers->has_key(request.method)
+ lspserver.customRequestHandlers[request.method](lspserver, request)
else
util.ErrMsg($'Unsupported request message received from the LSP server ({lspserver.path}), message = {request->string()}')
endif
customNotificationHandlers = server.customNotificationHandlers
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,
+ customRequestHandlers,
features, server.debug)
var ftypes = server.filetype
runIfSearchFiles: list<any>,
runUnlessSearchFiles: list<any>,
customNotificationHandlers: dict<func>,
+ customRequestHandlers: dict<func>,
features: dict<bool>, debug_arg: bool): dict<any>
var lspserver: dict<any> = {
id: GetUniqueServerId(),
syncInit: isSync,
initializationOptions: initializationOptions,
customNotificationHandlers: customNotificationHandlers,
+ customRequestHandlers: customRequestHandlers,
features: features,
running: false,
ready: false,
}
}])
<
- *lsp-cfg-features*
+ *lsp-cfg-customRequestHandlers*
+ customRequestHandlers
+ (Optional) some lsp servers will send additional
+ request replies which you might want to silence or
+ handle. The provided request handlers will be called
+ with a reference to the "lspserver" and the "request".
+ *lsp-cfg-features*
features
(Optional) toggle which features should be enabled for a
given language server. See |lsp-multiple-servers| and