AnalyticalGraphicsInc / gltf-vscode

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

Autocompletion for extensionsUsed? #231

Closed echadwick-artist closed 2 years ago

echadwick-artist commented 2 years ago

It would be helpful to add autocomplete for extensionsUsed.

Currently, autocomplete is great for adding extensions within a material. But it seems to be missing when adding extenstions to extensionsUsed.

  1. Type "ext and autocomplete suggests a few options
  2. Click on the extensionsUsed suggestion
  3. Within the brackets, type a quote character "
  4. Autocomplete should suggestion the full list of KHR extensions, just as it does within a material.

image

emackey commented 2 years ago

Hi @echadwick-wayfair, adding this autocomplete list to the extensionsUsed field is not easily done, for technical reasons (extensionsUsed is a JSON array of strings, where extensions is a JSON object with known properties, so the JSON schemas are quite different).

But there is a new "Quick Fix", added last November in #227, that can help you out here. Once you've added that KHR_materials_iridescence to the extensions block, you'll see this:

angry screenshot

The red squiggle is glTF Validator complaining I didn't mark the extension as used yet. But notice I've put my cursor on the name of the extension, and there's a blue light-bulb in the left margin. This is the "Quick Fix" indicator.

The same "Quick Fix" is also offered in a popup if you hover it:

popup screenshot

Clicking either of these will offer the only Quick Fix this project has to offer so far:

quick fix screenshot

Clicking that option will edit your document, possibly in a place far from your cursor, to add or update the extensionsUsed section. You may not immediately see what it did, but you should immediately see the red squiggle disappear, as the glTF Validator no longer has that particular concern about your document.

final screenshot

echadwick-artist commented 2 years ago

Oooh nice! This is great, thank you!