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

Open active file in hex editor doesn't work when another custom editor is opened #239

Closed
Tyriar opened this issue Mar 17, 2021 · 8 comments
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸

Comments

@Tyriar
Copy link
Member

Tyriar commented Mar 17, 2021

Not sure if the repro is another custom editor or related to the file type.

Repro:

  1. Install Luna Paint
  2. Open an image
  3. Run the open active file in hex editor command, it focuses the explorer

recording (8)

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Mar 17, 2021
@Tyriar
Copy link
Member Author

Tyriar commented Mar 17, 2021

This is because registerTextEditorCommand is used, not registerCommand. The fix should be easy, but I don't know how to get the uri for the active editor (not necessarily text).

@lramos15
Copy link
Member

Yeah this is a long standing issue, VS Code currently doesn't have an API to get the URI for the active editor. It's heavily requested and I know @eamodio was working on it at one point but I don't know the current progress. This is a command I added for discoverability but it doesn't work from custom editor to custom editor. I guess we could surface a notification here, although I do like to avoid notifications :)

@Tyriar
Copy link
Member Author

Tyriar commented Mar 17, 2021

I see there's a propose openEditors API, maybe that would do it. Though I'm not sure we know which is the active one.

@LinqLover
Copy link

This one is probably caused by the same problem: When I open a binary file in VS Code, instead of a regular text editor, a message is shown stating that the file encoding is not supported. "Open active file in hex editor" does not work in this scenario, either.

@Tyriar
Copy link
Member Author

Tyriar commented Jan 4, 2022

@lramos15 I hit this again the other day, how about in the failure case we just run the reopen editor with command as a workaround? That's a lot nicer and more convenient than just nothing happening.

@lramos15
Copy link
Member

@Tyriar this is still blocked until the finalization of microsoft/vscode#133532 because we do not know the URI of the active tab and therefore cannot use the commands

@Tyriar
Copy link
Member Author

Tyriar commented Jan 10, 2022

@lramos15 it's active, so you can just run the workbench.action.reopenWithEditor command.

@Tyriar
Copy link
Member Author

Tyriar commented Jun 20, 2022

@lramos15 the API is done now, could this get put on the plan soon?

lramos15 added a commit that referenced this issue Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug papercut 🩸
Projects
None yet
Development

No branches or pull requests

3 participants