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

Add API to reopen document with specific CustomTextEditor #169921

Open
adamerose opened this issue Dec 23, 2022 · 0 comments
Open

Add API to reopen document with specific CustomTextEditor #169921

adamerose opened this issue Dec 23, 2022 · 0 comments
Assignees
Labels
api custom-editors Custom editor API (webview based editors) feature-request Request for new features or functionality
Milestone

Comments

@adamerose
Copy link

adamerose commented Dec 23, 2022

My use case is this:

  • I defined a CustomTextEditor for viewing .md files.
  • I want to toggle between my custom editor and other editors (including the default plain text one) for the current document
  • Currently I do this by running workbench.action.closeActiveEditor chained with .then calling vscode.openWith to open my editor. There are problems with this...
    • It prompts the user with a confirmation dialog if the file has unsaved changes
    • Even if the document is already saved, closing and then reopening it causes the tab and title to briefly disappear/flicker
    • It loses track of undo history

Could there be an addition to the VS Code API that lets you seamlessly switch editors while keeping the file dirty and not losing the undo history?

I tried workbench.action.reopenWithEditor but this seems to behave the same as closing the current editor and opening a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api custom-editors Custom editor API (webview based editors) feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants