Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Json language services not working #333

Closed
perrinjerome opened this issue Apr 6, 2020 · 5 comments · Fixed by #337
Closed

Json language services not working #333

perrinjerome opened this issue Apr 6, 2020 · 5 comments · Fixed by #337

Comments

@perrinjerome
Copy link
Contributor

Language services for json files no longer seem to work.

This can be observed with yesterday's build:

docker run --rm --init -p 3000:3000 theiaide/theia:1.1.0-next.2c16d4e0

then open a json file, for example the preferences, try to complete, but only the "default" completions show up.
In the Output pane from JSON, we can see error message:

[Error - 10:30:52] Notification handler 'textDocument/didOpen' failed with message: Invalid TextDocumentSyncKind: [object Object]

image

For reference, an old tag where json language services were working: theiaide/theia:0.16.0-next.77297761. One difference is the version picked for vscode-json-languageserver@^1.2.1, 1.2.2 was OK and nowadays we have 1.2.3 which seems to cause this incompatibility.

At least if I run use this patch for force the resolution to 1.2.2, language services are working as expected:

diff --git a/theia-docker/latest.package.json b/theia-docker/latest.package.json
index 57b4ebf..d69129a 100644
--- a/theia-docker/latest.package.json
+++ b/theia-docker/latest.package.json
@@ -37,6 +37,7 @@
     "resolutions": {
         "vscode-languageserver-protocol": "3.15.0-next.9",
         "vscode-languageserver-types": "3.15.0-next.5",
+        "vscode-json-languageserver": "1.2.2",
         "**/vscode-json-languageserver/**/vscode-languageserver": "6.0.0-next.1"
     },
     "theiaPluginsDir": "plugins",

If you think this patch is correct and want me to submit a PR updating all package.json from this repository to have this resolution, let me know.

@vince-fugnitto
Copy link
Member

@perrinjerome thank you very much for pointing out the issue!
If you'd like to handle creating a pull-request to address the issue we'd most certainly appreciate it, else I can handle fixing the bug if you like.

I believe we can use the same resolution block as found in the main repository given that it works correctly in the images. I verified in the main repo and the JSON language features were working successfully.

https://github.com/eclipse-theia/theia/blob/d96e6f17097b0941075c497f1d61398c1d0c15f8/package.json#L9-L12

perrinjerome added a commit to perrinjerome/theia-apps that referenced this issue Apr 7, 2020
1.2.3 seems to cause incompatibities.

Fixes theia-ide#333
perrinjerome added a commit to perrinjerome/theia-apps that referenced this issue Apr 7, 2020
1.2.3 seems to cause incompatibities.

Fixes theia-ide#333

Signed-off-by: Jérome Perrin <[email protected]>
@perrinjerome
Copy link
Contributor Author

Thank you for feedback, I might be missing something, using the same resolution as on main repository did not work when I tried.

You said "it works correctly in the images", which images were you referring to ?

I made a draft pull request with this change #337 , but if there's a way that does not involve pinning an old version of vscode-json-languageserver it's probably better. Even though if I understood eclipse-theia/theia#7341 , the plan is to stop using @theia/json in favour of vscode-builtin-json-language-feature

@vince-fugnitto
Copy link
Member

You said "it works correctly in the images", which images were you referring to ?

I mentioned "given that it works correctly in the images" meaning that hopefully the same resolution block found in the main-repository would be enough but based on your previous comments it did not seem to work. I suspect that it's due to the fact the main-repository has a yarn.lock pinning the version (https://github.com/eclipse-theia/theia/blob/14531578a1eac6af55c6177ea857d39c38c9f09b/yarn.lock#L12866-L12876) while apps do not have any.

I made a draft pull request with this change #337 , but if there's a way that does not involve pinning an old version of vscode-json-languageserver it's probably better.

I'll verify the changes in a few moments once I get the chance :)

The plan is to stop using @theia/json in favour of vscode-builtin-json-language-feature

You're correct, when the builtin extension vscode-builtin-json-language-feature is ready and completely supported (schemas, validation, error reporting), then we will replace our own implementation @theia/json with it.

@perrinjerome
Copy link
Contributor Author

I suspect that it's due to the fact the main-repository has a yarn.lock pinning the version

ah yes that's definitively the reason, thanks.

@marcdumais-work
Copy link
Member

I have reproduced the issue using the Theia app from image theia-docker. indeed I see that by default [email protected] is pulled.

vince-fugnitto pushed a commit that referenced this issue Apr 9, 2020
1.2.3 seems to cause incompatibities.

Fixes #333

Signed-off-by: Jérome Perrin <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants