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

Extensions: jsonValidation json schema urls should support self-registered schemes #67189

Closed
johnspurlock opened this issue Jan 27, 2019 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality json JSON support issues verified Verification succeeded
Milestone

Comments

@johnspurlock
Copy link

Version: 1.30.2

Extensions are currently able to declare schemas for json files using the jsonValidation contribution point. The url property can point to an http or https url, or a static local resource. This works for simple, static scenarios.

However, it would be nice if the url could also point to a scheme registered by the extension as providing text content, so the schema could be generated (locally) dynamically. e.g. allow urls of the form custom:/path/to/file.json where custom is a scheme declared in the same extension's package.json.

@vscodebot vscodebot bot added the json JSON support issues label Jan 27, 2019
@aeschli
Copy link
Contributor

aeschli commented Jan 28, 2019

That already works, and is what we do for schemas of our configuration points.
e.g. see https://github.com/Microsoft/vscode/blob/33783baaa19ba89e30cf72469ba2086243997f51/extensions/configuration-editing/package.json#L45
the vscode:// resources come from a document content provider

use workspace.registerTextDocumentContentProvider to register a document content provider.

The document that is returned then ca contain the schema content, and can fire a document change event if the schema changes.

(for vscode the document content provider is registered with different APIs in the renderer, but it's basically the same)

@aeschli aeschli closed this as completed Jan 28, 2019
@johnspurlock
Copy link
Author

Can you please make sure vscode:// doesn't use a special code path?

Custom schemes do not work for me in 1.30.2. The provider is never called. I tried uris with and without an authority (e.g. custom:foo and custom://authority/foo) with no luck. Changing the url back to a local resource works.

@johnspurlock
Copy link
Author

Can you please re-check this? It is still not working in Version 1.31.0.

@aeschli
Copy link
Contributor

aeschli commented Feb 12, 2019

You are correct, I realised like the JSON language server only forwards the vscode protocol.

@aeschli aeschli reopened this Feb 12, 2019
@aeschli aeschli added this to the February 2019 milestone Feb 12, 2019
@johnspurlock
Copy link
Author

Seems to be working in Version: 1.32.0-insider
Commit: 11416de
Date: 2019-02-23T08:16:36.706Z
Electron: 3.1.3
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Darwin x64 18.2.0

Thanks!

@aeschli
Copy link
Contributor

aeschli commented Feb 24, 2019

Thanks for verifying!

@aeschli aeschli added verified Verification succeeded feature-request Request for new features or functionality labels Feb 24, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality json JSON support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants
@johnspurlock @aeschli and others