-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Send schema associations to JSON language server #2471
Comments
The VS Code's JSON language server expects a 'json/schemaAssociations' notification to associate JSON files to JSON schemas. This activates capabilities like code completion, validation and hover without the need to add a '$schema' key. This change implements an extension of the JsonBasedLanguageServer that registers as ServerInitializerObserver and sends the 'json/schemaAssociations' notification on the 'onServerInitialized' event. Signed-off-by: Kaloyan Raev <[email protected]>
I submitted PR #2474 with the fix. Note that it contains a hardcoded list of associations. It's enough as a first step, but in future we should think about an extensible way to contribute to this list by plugins. For example:
For reference here is how the PHP plugin in VS Code contributes the schema association for |
The VS Code's JSON language server expects a 'json/schemaAssociations' notification to associate JSON files to JSON schemas. This activates capabilities like code completion, validation and hover without the need to add a '$schema' key. This change implements an extension of the JsonBasedLanguageServer that registers as ServerInitializerObserver and sends the 'json/schemaAssociations' notification on the 'onServerInitialized' event. Signed-off-by: Kaloyan Raev <[email protected]>
@kaloyan-raev I'm moving this to M6 milestone because we're pushing to get M5 out ASAP. |
The VS Code's JSON language server expects a 'json/schemaAssociations' notification to associate JSON files to JSON schemas. This activates capabilities like code completion, validation and hover without the need to add a '$schema' key. This change implements an extension of the JsonBasedLanguageServer that registers as ServerInitializerObserver and sends the 'json/schemaAssociations' notification on the 'onServerInitialized' event. Signed-off-by: Kaloyan Raev <[email protected]>
@kaloyan-raev Concerning implementation to have code cleaner I would change a bit your approach. I would add a new entity |
@tolusha OK. I am curious to see how this new approach looks like. |
…pse-che#2474) The VS Code's JSON language server expects a 'json/schemaAssociations' notification to associate JSON files to JSON schemas. This activates capabilities like code completion, validation and hover without the need to add a '$schema' key. This change implements an extension of the JsonBasedLanguageServer that registers as ServerInitializerObserver and sends the 'json/schemaAssociations' notification on the 'onServerInitialized' event. Signed-off-by: Kaloyan Raev <[email protected]>
The VS Code language server expects a custom (not part of the protocol) notification
json/schemaAssociations
to associate JSON files to JSON schemas. This activates capabilities like code completion, validation and hover without the need to add a$schema
key.Here is an example object passed with the
json/schemaAssociations
notification:Currently, Che does not send the
json/schemaAssociations
notification, which significantly limits the capabilities of the JSON language server integration. It is not realistic to expect that users will manually add the$schema
key to each JSON file they work with.Reproduction Steps:
Expected behavior:
Code completion, validation and hover work without specifying a proper
$schema
key.Observed behavior:
Code completion, validation and hover do not work without specifying a proper
$schema
key.Che version: 5.0.0-M2-SNAPSHOT (latest master)
OS and version: Fedora 24
Docker version: 1.10.3
Che install: local build, run with the
bin/che.sh
scriptAdditional information:
The text was updated successfully, but these errors were encountered: