Closed lexaknyazev closed 3 years ago
I think this going to be a "won't fix". If you want a hover image just release the Ctrl and you'll get the normal image preview. onDefinition doesn't give any context about how its being used so changing behavior isn't possible. Its actually pretty hacky to get what we have working well as the system is built around navigating and presenting text documents.
Sorry, I don't quite understand. It's possible to Ctrl-hover over, e.g., Draco pointers and see some values in tool-tips. Ctrl-click opens a full list of values in a new document. Why can't image URIs behave the same way?
VSCode's onDefinition system provides a document URI and a cursor location and it expects a URI and a cursor location back. For JSON definition this works pretty simply; we use the same URI and find the location of the pointed to object. For data buffers we craft a new data URI which includes information on what accessor is under the cursor. The protocol handler for that data URI transforms the accessor into a new text document and VSCode shows this content where appropriate. For images the same type of data URI is constructed but we can't present text; we need to command VSCode to open a tab and show the image in an HTML page. We had in previous revisions of the extension just returned a URI directly to the image (which is what you see when hovering with out Ctrl). VSCode limits the size of images it will open in this way to 1MB and as you can see with the hover doesn't scale the image so you can see the whole thing in the editor window.
I can open an feature request with VSCode to allow definitions to return an HTML document. With this capability we'd be much more able to handle all the cases as expected.
Can't reproduce this anymore. I think it was fixed upstream.
1.21.1
, plugin2.1.7
.glTF-Sample-Models/2.0/BoxTextured/glTF/BoxTextured.gltf
)./images/0/uri
) URI.A new tab shouldn't appear without clicking.