-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[json] Request textDocument/* failed with message: Cannot read property 'version' of undefined #39344
Comments
@code-d I'm not able to reproduce. Can you add the following setting: |
@code-d Thanks a lot! What's strange is that there is no notification 'textDocument/didOpen' for
@dbaeumer Assigning to you, looks like an issue in the language client. |
@aeschli are you sure: the trace shows a hover request for tsconfig.json. Not sure who is triggering this. The protocol states that the server can receive requests for files that are not open in the editor. So the request is in principal valid. @code-d Would be cool to know if the file tsconfig.json is open in the editor when this happens. @aeschli assigning you as well since this might be a problem of the JSON language server as well. |
@code-d can you reproduce this with all extensions disabled. E.g start code form a terminal with |
@dbaeumer tried run from terminal with
|
hi, after hard debugging, i think i've found the cause of the issue: my temporary workaround: var headers = { 'Accept-Encoding': 'gzip, deflate' };
return request_light_1.xhr({ url: uri, followRedirects: 5, headers: headers }).then(function (response) {
return response.responseText;
}, function (error) {
return Promise.reject(error.responseText || request_light_1.getErrorStatusDescription(error.status) || error.toString());
}); change to var headers = { }; //if use gzip, the corrupted xhr response may never finish??
return request_light_1.xhr({ url: uri, followRedirects: 5, headers: headers }).then(function (response) {
// try {
JSON.parse(response.responseText); //try parse now, throw error if response data is corrupted
// } catch (e) {
// throw e;
// }
return response.responseText;
}, function (error) {
return Promise.reject(error.responseText || request_light_1.getErrorStatusDescription(error.status) || error.toString());
}); |
The second trace has a hint why this is happening. For some reason the JSON server crashes and is not restarted correctly. Would be good to know why it is crashing / the connection is closed
|
@code-d very nice analysis. Thanks for the hard debugging. This explains why the server is crashing and not restarting. |
@aeschli this means even if the LSP client would restart the server it would crash 5 times and then would be dead as well. Open microsoft/vscode-languageserver-node#286 to handle this better in the client. However there is additional work in the JSON server necessary. Leaving this work in this item. |
Publish 4.0.0-next.3 of the client which contains a fix for the exception handling. But please note that this version will not fix the underlying problem of the server crashing. |
@dbaeumer Any chance the error message sent to the client ( |
@aeschli Currently I implement the JSON RPC spec (http://www.jsonrpc.org/specification#error_object). We could add a stack to the data property or add an additional property. But both would be LSP specific and clients would need to know about this. |
@code-d Thanks for your investigations and findings.
|
@aeschli still receive the error message in 1.19 |
@aeschli hi, i finally found out the issue is related to your 'request-light' module: |
Thanks a lot @code-d, that's a great help. I made a fix, this should be in tomorrows build. It would be great if you can verify if the fix works for you. |
@code-d Were you able to verify that this fix in one of the latest insider builds? |
@aeschli How do you recommend we go around verifying this? |
@aeschli hi, i've tested. the error is gone.. i think it has been fixed ps. strictly speaking: i can't verify the case of malformed schema/response data, because the responses from |
Thanks @code-d, that's good enough, we mark it as verified. |
Output of "JSON Language Server" always show following error:
Steps to Reproduce:
2a. double-click anywhere in the document
2b. ctrl+space
The text was updated successfully, but these errors were encountered: