How to reuse vscode-json-languageservice?

2019-08-27 11:38发布

I have an Electron app that operates on JSON data, and the JSON data has schema files. The data is served up to my Electron app via Python Flask, and the Electron app displays it and allows editing it (in an abstraction of JSON). I want to enable showing validation of the fields in the Electron app.

We wrote the schemas in VSCode and so they all have $schema keys and use many $refs to other schema files.

I've found libraires like avj which seem interesting, but then found https://www.npmjs.com/package/vscode-json-languageserver https://www.npmjs.com/package/vscode-json-languageservice

which seem really useful. I would like to be able to use the same JSON validation that VSCode uses in my Electron app. It's not clear to me how to use these packages however. I feel like it would be feasible to use the languageservice and construct a service to call doValidation() on, but it's not clear how I would accomplish this with the API.

0条回答
登录 后发表回答