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

Support command attribute on languages contribution #71086

Closed
dschaefer opened this issue Mar 25, 2019 · 3 comments
Closed

Support command attribute on languages contribution #71086

dschaefer opened this issue Mar 25, 2019 · 3 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@dschaefer
Copy link

I know opening custom editors for non text files has been raised before but discussion seems to have stalled. Instead, I'll propose the start of a solution.

The example that brought this to the forefront again was the vscode-pdf extension. It's probably the best done that I've seen but is still a huge hack and you still get a pretty weird user experience.

It listens for onDidOpenTextDocument and if the document has the language id it added, i.e. "pdf", it closes the active editor (assuming I guess that the current document is in the active editor), and opens up it's custom editor that renders pdf files instead.

That is essentially the behavior we're looking for. But I can imagine it would be much cleaner if we were allowed to register a command id with the language that would be run when opening the text document that short circuits the hack needed in the extension.

That still leaves hooking up editor menu commands like undo and save, but at least we could get viewers like the PDF one working much more cleanly.

@jrieken jrieken assigned bpasero and unassigned jrieken Mar 25, 2019
@jrieken
Copy link
Member

jrieken commented Mar 25, 2019

/duplicate of #12176

@vscodebot vscodebot bot added the *duplicate Issue identified as a duplicate of another issue(s) label Mar 25, 2019
@vscodebot
Copy link

vscodebot bot commented Mar 25, 2019

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Mar 25, 2019
@jrieken
Copy link
Member

jrieken commented Mar 25, 2019

Closing as dupe of #12176. Adding a command to the languages is really not the right layer for this. This should be done somewhere in the opening world...

@vscodebot vscodebot bot locked and limited conversation to collaborators May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants