Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to open non-text files via API #566

Closed
seanmcbreen opened this issue Nov 24, 2015 · 11 comments
Closed

Allow to open non-text files via API #566

seanmcbreen opened this issue Nov 24, 2015 · 11 comments
Assignees
Labels
api feature-request Request for new features or functionality
Milestone

Comments

@seanmcbreen
Copy link

From @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

@seanmcbreen
Copy link
Author

From @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

@thomas-jeepe
Copy link

Progress so far?

@newtack
Copy link

newtack commented May 25, 2016

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.

@jrieken
Copy link
Member

jrieken commented May 25, 2016

I'll see what June allows

@jrieken jrieken modified the milestones: June 2016, Backlog May 25, 2016
@jrieken jrieken added feature-request Request for new features or functionality api labels May 25, 2016
@ArtemGovorov
Copy link
Contributor

@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

@jrieken
Copy link
Member

jrieken commented May 25, 2016

previewHtml FTW

@thomas-jeepe
Copy link

Awesome!

@newtack
Copy link

newtack commented May 26, 2016

Fantastic!

@jrieken
Copy link
Member

jrieken commented Jun 25, 2016

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

@bpasero
Copy link
Member

bpasero commented Jun 25, 2016

No, because it's resolve method will try to make a text editor model out of it (https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/common/editor/resourceEditorInput.ts#L159)

@bpasero
Copy link
Member

bpasero commented Jun 25, 2016

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.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

7 participants