vscode
vscode copied to clipboard
[json] Provide programmatic access to active JSON schemas
I'm working on a VS Code extension that provides an alternative JSON editor, and it would be useful if I could reuse the JSON schema resolution logic that the built-in JSON language server uses. That would allow any alternative editor to automatically respect the json.schemas
setting and the jsonValidation
contribution point.
I don't have strong feelings on exactly how the API should look, but one simple option would be to have the built-in json-language-features
extension register a new json.getSchemaForUri
command with accepts a vscode.Uri
and returns either an object representing the JSON schema associated with that URI or undefined
if no schema was found. Other extensions could invoke this command when needed to get the schema associated with an arbitrary JSON file.
I think you would have to come up with a PR here yourself... This is a bit of work (also later, when maintaining such an API) and unless there's a great demand, we won't do it.
Thanks, that makes sense to me. I just wanted to be sure I wasn't missing an existing API or architectural issue before going down that path.
On Wed, Sep 21, 2022, 2:00 AM Martin Aeschlimann @.***> wrote:
I think you would have to come up with a PR here yourself... This is a bit of work (also later, when maintaining such an API) and I unless there's a great demand, we won't do it.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/161360#issuecomment-1253411319, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVINJFWU43EF6XNFRWIQ3LV7LFC3ANCNFSM6AAAAAAQRR66RU . You are receiving this because you authored the thread.Message ID: @.***>
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!