fix: guard against optional client capabilities (#602)
for client like lsp-mode for emacs which doesn't have colorProvider, server is failing to start, and according to the specification, the capabilities here is all optional, so we should guard the nil situation.master
parent
aeb1595b86
commit
d32e11fa60
|
@ -1563,10 +1563,10 @@ class DocumentService {
|
||||||
function supportsDynamicRegistration(connection: Connection, params: InitializeParams): boolean {
|
function supportsDynamicRegistration(connection: Connection, params: InitializeParams): boolean {
|
||||||
return (
|
return (
|
||||||
connection.onInitialized &&
|
connection.onInitialized &&
|
||||||
params.capabilities.textDocument.hover.dynamicRegistration &&
|
params.capabilities.textDocument.hover?.dynamicRegistration &&
|
||||||
params.capabilities.textDocument.colorProvider.dynamicRegistration &&
|
params.capabilities.textDocument.colorProvider?.dynamicRegistration &&
|
||||||
params.capabilities.textDocument.codeAction.dynamicRegistration &&
|
params.capabilities.textDocument.codeAction?.dynamicRegistration &&
|
||||||
params.capabilities.textDocument.completion.dynamicRegistration
|
params.capabilities.textDocument.completion?.dynamicRegistration
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue