Skip to content

Allow to open non-text files via API #566

Closed

Description

From Artem Govorov (@ArtemGovorov) on November 17, 2015 3:8

I can open an image (PNG) in the editor manually and there's workspace.openTextDocument, but, as expected from the function name, I can't use it to open the image file: "cannot open file:///.... Detail: File seems to be binary and cannot be opened as text". Perhaps there should be another function, such as openFile that could open any supported file type?

Copied from original issue: Microsoft/vscode-extensionbuilders#117

Activity

  1. seanmcbreen commented on Nov 24, 2015

    @seanmcbreen
    Author

    From Johannes Rieken (@jrieken) on November 18, 2015 13:16

    I like. Idea is to make the underlying command we already have so that it can accept an uri executeCommand

  2. thomas-jeepe commented on May 25, 2016

    @thomas-jeepe

    Progress so far?

  3. newtack commented on May 25, 2016

    @newtack

    Wallabyjs offers the ability to display a screenshot of the last screen in the unit test in other GUIs (WebStorm, etc.). We really want this functionality in our preferred code editor VSCode as well.

  4. jrieken commented on May 25, 2016

    @jrieken
    Contributor

    I'll see what June allows

  5. added
    feature-request
    on May 25, 2016
  6. ArtemGovorov commented on May 25, 2016

    @ArtemGovorov
    Contributor

    Johannes Rieken (@jrieken) Thanks! No rush, I think I found a good alternative by essentially wrapping the image into an HTML page and displaying the HTML document with the vscode.previewHtml command (and custom content provider).

    vsc

  7. jrieken commented on May 25, 2016

    @jrieken
    Contributor

    previewHtml FTW

  8. thomas-jeepe commented on May 25, 2016

    @thomas-jeepe

    Awesome!

  9. newtack commented on May 26, 2016

    @newtack

    Fantastic!

  10. jrieken commented on Jun 25, 2016

    @jrieken
    Contributor

    Benjamin Pasero (@bpasero) Is this low hanging? Can I use the usual trick with a ResourceEditorInput?

  11. bpasero commented on Jun 25, 2016

    @bpasero
    Contributor

    But from the workbench point of view you can pass in a file:/// URI pointing to an image and it will open as image. So I think everything should just work if you end up calling IEditorService.openEditor.

  12. locked and limited conversation to collaborators on Nov 18, 2017
  13. added a commit that references this issue on Sep 6, 2026
    b2192b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apifeature-request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions