AnalyticalGraphicsInc / gltf-vscode

This is an extension for Visual Studio Code to add support for editing glTF files.
Apache License 2.0
460 stars 63 forks source link

Extension schemas #119

Closed emackey closed 6 years ago

emackey commented 6 years ago

This PR introduces a new means to wire up known glTF extension schemas to VSCode's JSON validation service. Initially this is just hookup for KHR extensions, but in the future this is expected to expand to also cover some well-documented vendor extensions. (Once this is merged, please open a new issue to request any vendor extension you would like to see covered here).

The new extension schemas are all imported via the util/importSchema.js script, the same way the core glTF schemas are, that automates a few key modifications needed for best handling of the schemas in VSCode's JSON validation. A new lookup table, util/extensionMap2.0.json offers the wire-up instructions for connecting particular core glTF schema extension objects to particular extensions that target those objects. A new script util/importAll.sh will re-run the import for all supported schemas at once.

Unknown extensions are still permitted by the editor (although the glTF Validator will still complain about unknown extension prefixes and the like, as expected). Known extensions will now have complete JSON schema validation, with hover tooltips, auto-complete (CTRL-space), and document problems called out for missing properties and unknown values.

Thanks to @lexaknyazev for a key piece of schema advice that allowed this effort to move forward.

TODO:

emackey commented 6 years ago

Work-in-progress: The hand-edits were making me sad too, so I'm migrating them to a legit lookup table.

emackey commented 6 years ago

OK. No new hand-edited schemas are being submitted with this PR. A new look-up table extensionMap2.0.json has taken the role of helping importAll.sh bring in all of the various extension schemas and bind them all together into a coherent whole for VSCode's sake.