How to reuse vscode-json-languageservice?

独自空忆成欢 提交于 2019-12-11 15:25:18

问题


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.

来源:https://stackoverflow.com/questions/55522198/how-to-reuse-vscode-json-languageservice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!