我有一个巨大的 JSON 设置文件,用于我的一个项目。我想通过 JSON 模式编写一些文档和验证规则,以便不熟悉该文件的人更容易编辑该文件。
我希望能够在 Eclipse 中打开 json 设置文件,并通过智能感知自动完成 json 属性。我还想在鼠标悬停在任何 json 设置属性上时查看其文档注释。
我找不到有关此功能的任何类型的文档。这可以用 eclipse 实现吗?
最佳答案
我会回答我自己的问题,因为我发现这样做的方法非常简单并且效果很好。
所以,
· Having a test.json file which contains the setup of your project which you want to get autocomplete features on
· Having a c:\test.schema.json file which contains the schema for your setup file
在 eclipse 上激活此功能的步骤是:
1- Open eclipse
2- go to "Window > Preferences: JSON > JSON Catalog"
3- add a new entry with "test.json" as the file and "file:/c:/test.schema.json" as the URL
4- enable syntax and schema validation under "Window > Preferences: JSON > JSON Files > Validation"
5- Apply the changes
6- Open the test.json file with eclipse and check that ctrl + space performs autocomplete
我发现这个过程中唯一乏味的部分是每次修改 json 架构文件时,您都必须再次转到“窗口 > 首选项:JSON > JSON 目录”并再次应用更改刷新新值
关于json - 是否可以使用 Eclipse 自动完成 JSON 模式和文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51983779/