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

dynamic schema not updating #79363

Closed
ramank775 opened this issue Aug 17, 2019 · 8 comments
Closed

dynamic schema not updating #79363

ramank775 opened this issue Aug 17, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Milestone

Comments

@ramank775
Copy link
Contributor

I am looking for a plugin API where a custom plugin can update contributes specially jsonValidation schema programmatically. Currently a plugin can add a schema in package.json file.

I am developing a plugin where user able to create json schema definition within the workspace or reference any existing schema as definition and can perform validation against the schema generated by the plugin.

Note: I have explore existing json language server, but it only has support for file based or remote schema.

@vscodebot
Copy link

vscodebot bot commented Aug 17, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@aeschli
Copy link
Contributor

aeschli commented Aug 20, 2019

This comment describes how you can register a schema with dynamic content:
#77433 (comment)

@aeschli aeschli closed this as completed Aug 20, 2019
@ramank775
Copy link
Contributor Author

@aeschli Thanks for the update

@ramank775
Copy link
Contributor Author

@aeschli can you help with clearing schema cache when dynamic schema change?

@aeschli
Copy link
Contributor

aeschli commented Aug 21, 2019

The TextDocumentContentProvider that you provide has a onDidChange event. You must fire this event when the document with your schema changes. The JSON language server will then clear its cache and reload the schema.

@ramank775
Copy link
Contributor Author

ramank775 commented Aug 21, 2019

@aeschli onDidChange event do not clear the schema, i have tried this approach.

The Reason why JSON language server not clearing the schema is the following code
let handleContentChange = (uri: Uri) => { if (uri.scheme === 'vscode' && uri.authority === 'schemas') { client.sendNotification(SchemaContentChangeNotification.type, uri.toString()); } };

This is in JSON language server client code here , which check if the content change has schema vscode and prevents the resetSchema function being executed on the server.

@aeschli
Copy link
Contributor

aeschli commented Aug 21, 2019

@ramank775 Good catch!

@aeschli aeschli reopened this Aug 21, 2019
@aeschli aeschli changed the title Adding/Updating json schema programmatically from third party plugin dynamic schema not updating Aug 21, 2019
@aeschli aeschli added this to the August 2019 milestone Aug 21, 2019
@aeschli aeschli added json JSON support issues bug Issue identified by VS Code Team member as probable bug labels Aug 21, 2019
@ramank775
Copy link
Contributor Author

@aeschli Thanks. 👍

@mjbvz mjbvz added the verified Verification succeeded label Aug 28, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug json JSON support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants