Is it possible to have JSON schema autocomplete an

2019-08-19 23:35发布

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条回答
别忘想泡老子
2楼-- · 2019-08-20 00:20

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

查看更多
登录 后发表回答