Skip to content
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

support contributes.jsonValidation VSCode API. #7560

Closed
wants to merge 1 commit into from
Closed

support contributes.jsonValidation VSCode API. #7560

wants to merge 1 commit into from

Conversation

bd82
Copy link
Contributor

@bd82 bd82 commented Apr 13, 2020

What it does

Support VSCode contributes.jsonValidation API.

Note that jsonValidation contribution have a higher priority than SchemaStore schemas, and a lower priority than registered schemas from the preferences
(In case of identical fileMatch strings).

How to test

  • Create a dummy VSCode ext
  • Add in its package.json contributes.jsonValidation section pointing to some schema from the schema store with an appropriate fileMatch property`.
  • Bundle your VSCode ext into a VSIX and place it the plugins folder.
  • Start Theia
  • Inspect that the JSON schema is used from the given

Review checklist

Reminder for reviewers

@bd82
Copy link
Contributor Author

bd82 commented Apr 13, 2020

Hmm I need to figure out how to sign the commit

I guess i need smaller case -s instead of -S which tries using gpg keys...

@akosyakov akosyakov added the vscode issues related to VSCode compatibility label Apr 14, 2020

registerJsonValidation(jsonValidationEntry: JsonSchemaConfiguration): Disposable {
this.registry.push(jsonValidationEntry);
return Disposable.NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disposable.NULL is bogus, please use JsonSchemaStore.registerSchema instead. it has a proper logic to unregster configuration

Copy link
Member

@akosyakov akosyakov Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bd82 It was not addressed, this should remove entry from this.registry and json language server should be notified about it as well

@@ -11,6 +11,7 @@
"@theia/editor": "^1.0.0",
"@theia/file-search": "^1.0.0",
"@theia/filesystem": "^1.0.0",
"@theia/json": "^1.0.0",
Copy link
Member

@akosyakov akosyakov Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this dependency, we only need to register configuration in core json schema storage

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benoitf @tolusha It goes against #6647, are you fine with it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azatsarynnyy Do you know whether introducing such dependency will cause issues in Che? i.e. do you use json vscode built-in extensions already?

@akosyakov
Copy link
Member

akosyakov commented Apr 15, 2020

I'm not sure about this PR. The issue is that we should drop @theia/json and switch to json-language-features vscode extension, after that contributes.jsonValidation should be implemented to work with the built-in extension.

But we can accept is as a temporary solution? cc @eclipse-theia/ecd-theia-committers

@bd82 please remove after closing of #3983 from the commit and PR descriptions. It does not resolve it without switching to the built-in.

@akosyakov
Copy link
Member

@akosyakov akosyakov added the json issues related to the json language label Apr 15, 2020
@bd82
Copy link
Contributor Author

bd82 commented Apr 15, 2020

@akosyakov are there any estimated timelines for switching out @theia/json?

@akosyakov
Copy link
Member

@bd82 I hope within next 2 months. We are planning to work on removing monaco-languageclient and getting rid of @theia/json is a prerequisite. cc @marcdumais-work @svenefftinge

I think we can accept this PR for time being, but there are still 2 issues:

@bd82
Copy link
Contributor Author

bd82 commented Apr 15, 2020

I will fix the "wrong shapes" in the next few days/

I hope within next 2 months.

Hmm, probably best if we can merge this PR as a temp solution (once review passes).
As there is also additional delay for consumers of Theia until they can upgrade version due
to other products life-cycles concerns...

Signed-off-by: I060847 <shachar.soel@sap.com>
@bd82
Copy link
Contributor Author

bd82 commented Apr 20, 2020

Hi @akosyakov I've fixed the wrong shape and another relevant CR comment.
I will now do more manual testing.

@bd82
Copy link
Contributor Author

bd82 commented Apr 20, 2020

O.k. I've tested manually for both scenarios of fileMatch as a single string and as an array of strings. works well.

@@ -14,6 +16,7 @@ Use `PluginManager.configStorage` property instead. [#7265](https://github.com/e

## v1.0.0

- [core] `CommandRegistry#getAllHandlers` returns with the reversed order of handlers, so if a command has multiple handlers, any handler is considered to be more specific than the other subsequent handlers in the array. In other words, if `@theia/core` contributes a handler for a particular command and your extension also contributes a handler for the same command, the handler from your extension will have `0` index, and the handler from `@theia/core` will have `1` index when calling `getAllHandlers`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be here. How did you get it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oy probably via a rebase to update my local branch

@akosyakov akosyakov changed the title fix: 3983 support contributes.jsonValidation VSCode API. support contributes.jsonValidation VSCode API. Apr 22, 2020
allConfigs.push(...config);
}
const schemaStoreConfigs = this.jsonSchemaStore.getJsonSchemaConfigurations();
const pluginContributionConfigs = this.jsonValidationContributionsRegistry.getJsonValidations();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such configs can be registered dynamically, i.e. a user install or uninstall new extension. registry should fire an event and contribution should trigger updateSchemas then

@akosyakov
Copy link
Member

@bd82 please see comments

@thegecko
Copy link
Member

thegecko commented May 7, 2020

whether it is fine to pull @theia/json via @theia/plugin-ext.

I think that's OK. I seem to remember the debug package requires json anyway to correctly show the UI for configuring debug configs.

@bd82
Copy link
Contributor Author

bd82 commented May 7, 2020

I will try to find time to get back to this PR next week.

@bd82
Copy link
Contributor Author

bd82 commented Jun 10, 2020

Hello @akosyakov.

I am having difficulty finding the time to complete this...
I wonder if this is still relevant?

  • considering the upcoming switch to json-language-features vscode extension?

Is there any update /time estimates on said switch?

Thanks.
Shahar.

@akosyakov
Copy link
Member

We've already started looking into it. The latest is mid of next month.

@bd82
Copy link
Contributor Author

bd82 commented Jun 10, 2020

We've already started looking into it. The latest is mid of next month.

Thanks for the update @akosyakov

@bd82
Copy link
Contributor Author

bd82 commented Jun 10, 2020

I think this PR is now redundant so I'm closing it.

@bd82 bd82 closed this Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json issues related to the json language vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants