Unhandled Promise rejections with dynamicRegistration disabled #498
Closed
Description
opened on Jun 25, 2021
Describe the bug
I've been adding yaml-language-server to Nova.app, this makes writing and managing YAML so much easier, thank you! Nova doesn't support dynamicRegistration and it is causing two Unhandled promise rejections as of 0.20.0
.
The first seems to be vscode-languageclient-node#713
, which is due to be fixed in the upcoming 7.1
release.
I think the second unhandled rejection is coming from here:
Should this line include a check for clientDynamicRegisterSupport
?
if (this.yamlSettings.hasConfigurationCapability && this.yamlSettings.clientDynamicRegisterSupport) {
I've been tracking this locally at robb-j/nova-yaml#4
Expected Behavior
It shouldn't have any unhandled promise rejections, in Node 15+ they will cause the process to exit.
Current Behavior
Error messages
Registering request handler for workspace/didChangeWorkspaceFolders failed.
(node:67143) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
at handleResponse (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
at processMessageQueue (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
at Immediate.<anonymous> (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
at processImmediate (internal/timers.js:464:21)
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:224:9)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:67143) Error: Invalid parameter: registrations
Registrations must be of type Registration[]
at handleResponse (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
at processMessageQueue (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
at Immediate.<anonymous> (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
at processImmediate (internal/timers.js:464:21)
Registering request handler for workspace/didChangeConfiguration failed.
(node:67143) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations
Registrations must be of type Registration[]
at handleResponse (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
at processMessageQueue (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
at Immediate.<anonymous> (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
at processImmediate (internal/timers.js:464:21)
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:224:9)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
at runNextTicks (internal/process/task_queues.js:64:3)
at processImmediate (internal/timers.js:437:9)
(node:67143) Error: Invalid parameter: registrations
Registrations must be of type Registration[]
at handleResponse (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
at processMessageQueue (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
at Immediate.<anonymous> (/Users/nra76/Library/Application Support/Nova/Extensions/robb-j.yaml/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
at processImmediate (internal/timers.js:464:21)
LSP startup messages
These are from a hacky script I made to visualise stdin/out of Nova's LSP integration, to be similar to VSCode's trace option.
[Trace - 9:17:53 PM] Sending Request 'initialize' (0)
Params: {
"rootUri": "file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/",
"rootPath": "/Volumes/Macintosh HD/Users/rob/dev/nova/yaml",
"workspaceFolders": [
{
"uri": "file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/",
"name": "yaml"
}
],
"capabilities": {
"workspace": {
"configuration": true,
"applyEdit": true,
"executeCommand": {},
"workspaceFolders": true,
"workspaceEdit": {
"failureHandling": "undo",
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
]
}
},
"textDocument": {
"rename": {
"prepareSupport": true
},
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.inline",
"refactor.extract",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"isPreferredSupport": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"completion": {
"completionItem": {
"snippetSupport": true,
"deprecatedSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"tagSupport": {
"valueSet": [
1
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"contextSupport": true
},
"codeLens": {},
"documentHighlight": {},
"synchronization": {
"didSave": true,
"willSave": true,
"willSaveWaitUntil": true
},
"publishDiagnostics": {
"versionSupport": true,
"relatedInformation": true
},
"declaration": {
"linkSupport": true
},
"typeDefinition": {
"linkSupport": true
},
"definition": {
"linkSupport": true
},
"implementation": {
"linkSupport": true
},
"signatureHelp": {
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
]
}
}
}
},
"processId": 14279,
"clientInfo": {
"name": "Nova",
"version": "7"
}
}
[Trace - 9:17:53 PM] Sending Notification 'yaml/registerCustomSchemaRequest'
Params: {}
[Trace - 9:17:53 PM] Received Response 'initialize' (0)
Result: {
"capabilities": {
"textDocumentSync": 2,
"completionProvider": {
"resolveProvider": false
},
"hoverProvider": true,
"documentSymbolProvider": true,
"documentFormattingProvider": false,
"documentOnTypeFormattingProvider": {
"firstTriggerCharacter": "\n"
},
"documentRangeFormattingProvider": false,
"documentLinkProvider": {},
"foldingRangeProvider": false,
"codeActionProvider": true,
"codeLensProvider": {
"resolveProvider": false
},
"executeCommandProvider": {
"commands": [
"jumpToSchema"
]
},
"workspace": {
"workspaceFolders": {
"changeNotifications": true,
"supported": true
}
}
}
}
[Trace - 9:17:53 PM] Sending Notification 'initialized'
Params: {}
[Trace - 9:17:53 PM] Sending Notification 'textDocument/didOpen'
Params: {
"textDocument": {
"text": "#\n# This file tests an Kubernetes ingress\n#\n\napiVersion: networking.k8s.io/v1beta1\nkind: Ingress\nmetadata:\n name: sample-ingress\n annotations:\n cert-manager.io/cluster-issuer: letsencrypt-prod\n ingress.kubernetes.io/ssl-redirect: \"true\"\nspec:\n rules:\n - host: example.com\n http:\n paths:\n - path: /\n backend:\n serviceName: sample-service\n servicePort: 80\n\n tls:\n - hosts:\n - example.com\n secretName: example.com\n",
"languageId": "yaml",
"uri": "file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/examples/ingress.yml",
"version": 19
}
}
[Trace - 9:17:53 PM] Sending Request 'textDocument/codeAction' (1)
Params: {
"range": {
"start": {
"line": 8,
"character": 11
},
"end": {
"line": 8,
"character": 11
}
},
"textDocument": {
"uri": "file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/examples/ingress.yml"
},
"context": {
"diagnostics": []
}
}
[Trace - 9:17:53 PM] Received Request 'client/registerCapability' (0)
Params: {
"registrations": [
{
"id": "668eb76c-623d-4425-af9a-136b6220e9cc",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
[Trace - 9:17:53 PM] Received Request 'client/registerCapability' (1)
Params: {
"registrations": [
{
"id": "f9936b2f-6fdd-46e0-9ff8-7a747ebc013d",
"method": "workspace/didChangeConfiguration",
"registerOptions": {}
}
]
}
[Trace - 9:17:53 PM] Received Request 'workspace/configuration' (2)
Params: {
"items": [
{
"section": "yaml"
},
{
"section": "http.proxy"
},
{
"section": "http.proxyStrictSSL"
},
{
"section": "[yaml]"
}
]
}
[Trace - 9:17:53 PM] Sending Request 'client/registerCapability' (0)
Error: {
"message": "Invalid parameter: registrations\nRegistrations must be of type Registration[]",
"code": -32602
}
[Trace - 9:17:53 PM] Sending Request 'client/registerCapability' (1)
Error: {
"message": "Invalid parameter: registrations\nRegistrations must be of type Registration[]",
"code": -32602
}
[Trace - 9:17:53 PM] Sending Response 'workspace/configuration' (2)
Result: [
{
"format.enable": true,
"validate": true,
"customTags": [
"!secret scalar"
],
"completion": true,
"schemas": {},
"hover": true
},
{},
{},
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": true
}
]
[Trace - 9:17:53 PM] Received Response 'unknown' (1)
Result: []
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 3,
"message": "Registering request handler for workspace/didChangeWorkspaceFolders failed."
}
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 1,
"message": "(node:17633) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations\nRegistrations must be of type Registration[]\n at handleResponse (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n at processMessageQueue (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n at Immediate.<anonymous> (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n at processImmediate (internal/timers.js:461:21)\n at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)\n at processPromiseRejections (internal/process/promises.js:224:9)\n at processTicksAndRejections (internal/process/task_queues.js:94:32)"
}
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 1,
"message": "(node:17633) Error: Invalid parameter: registrations\nRegistrations must be of type Registration[]\n at handleResponse (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n at processMessageQueue (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n at Immediate.<anonymous> (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n at processImmediate (internal/timers.js:461:21)"
}
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 3,
"message": "Registering request handler for workspace/didChangeConfiguration failed."
}
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 1,
"message": "(node:17633) UnhandledPromiseRejectionWarning: Error: Invalid parameter: registrations\nRegistrations must be of type Registration[]\n at handleResponse (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n at processMessageQueue (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n at Immediate.<anonymous> (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n at processImmediate (internal/timers.js:461:21)\n at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)\n at processPromiseRejections (internal/process/promises.js:224:9)\n at processTicksAndRejections (internal/process/task_queues.js:94:32)\n at runNextTicks (internal/process/task_queues.js:62:3)\n at processImmediate (internal/timers.js:434:9)"
}
[Trace - 9:17:53 PM] Received Notification 'window/logMessage'
Params: {
"type": 1,
"message": "(node:17633) Error: Invalid parameter: registrations\nRegistrations must be of type Registration[]\n at handleResponse (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)\n at processMessageQueue (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)\n at Immediate.<anonymous> (/Users/rob/dev/nova/yaml/yaml.novaextension/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)\n at processImmediate (internal/timers.js:461:21)"
}
[Trace - 9:17:53 PM] Received Request 'custom/schema/request' (3)
Params: [
"file:///Volumes/Macintosh%20HD/Users/rob/dev/nova/yaml/examples/ingress.yml"
]
[Trace - 9:18:16 PM] Sending Request 'shutdown' (2)
Params: {}
[Trace - 9:18:16 PM] Sending Notification 'exit'
Params: {}
[Trace - 9:18:16 PM] Received Response 'shutdown' (2)
Steps to Reproduce
- Turn on the LanguageServer in Nova
Environment
- Windows
- Mac
- Linux
- other (please specify)
Activity