Is it possible to have JSON schema autocomplete and documentation with eclipse?

孤者浪人 提交于 2019-12-24 08:35:01

问题


I have a massive JSON setup file that I use with one of my projects. I would like to write some documentation and validation rules via a JSON schema so the edition of this file is easier for someone who's not familiar with it.

I want to be able to open the json setup file in Eclipse and have autocomplete for the json properties via intellisense. I also want to see the documentation comments for any json setup property when the mouse is over it.

I can't find any kind of documentation about this feature. Is this possible with eclipse?


回答1:


I will answer my own question, cause I found the way to do it pretty easy and works quite well.

So,

· 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

The steps to activate this feature on eclipse are:

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

The only tedious part of this process that I've found is that every time the json schema file gets modified, you have to go again to "Window > Preferences: JSON > JSON Catalog" and apply the changes again to refresh the new values



来源:https://stackoverflow.com/questions/51983779/is-it-possible-to-have-json-schema-autocomplete-and-documentation-with-eclipse

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