Code completion based on Json file

Hi all,

In my javascript code, most of the time, I have functions where their input parameters are JSON objects. What happens is that, when I reference a field, Webstorm shows a warning saying that the field is unresolved.

Since I have sample JSON files for these parameters, I was wondering if Is there a way to tell Webstorm to check against these files, so that it will recognize those JSON fields.

Thanks

0
2 comments
Avatar
Permanently deleted user

I know that I could use JSDoc for that, however input file are very long and sometimes I have up to 3 input parameters, using JSDoc would make code unreadable. I prefer to describe the input type and then use an external json file for describing the structure.

0

No, you can't do this unless you explicitly import JSON in your code with require() call/import statement (in such cases, the IDE will attempt to resolve fields from imported JSON files)

0

Please sign in to leave a comment.