-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Description
We are trying in our extension to open a Markdown preview to the side (A second editor group), but as a "preview editor" (AKA Italic tab title) that will get replaced should a user choose to open another Markdown file/preview afterwards. Yet we couldn't figure out a way to get this to work. We have tried the following:
-
The
markdown.showPreviewToSidecommand adds a new tab to the editor group each time it runs (And doesn't open it as a "preview editor", themarkdown.showPreviewcommands open in the current editor group but does replace a previously opened Markdown file/preview, yet isn't a de-facto "preview editor" (The tab title is not in italic), so the logic for replacing it might be a custom implementation inside the built-in Markdown extension. -
vscode.openWithallows to open a Markdown tab as a custom editor rather than a webview panel, yet it ignores thepreview/pinnedflag, always defaulting it to not open as preview.return editorService.openEditor({ resource: URI.revive(resource), options: { ...optionsArg, pinned: true, override: id } }, group); -
Trying to manually kludge such behavior using
vscode.window.tabGroups, but it is async with the API to actually open an editor, and it is difficult to match the exact tab that we just opened from the information available in the callback, we can only match on the tab title which seems very very brittle.
We would love there to be an API that makes it easy to do this, so we can make our extension's sidebar open the Markdown preview in "preview" mode and behave in a similar way to clicking on files in the built-in file explorer.
P.S. The API for opening a web view panel doesn't even support a flag to open it as a preview editor, unlike the API for opening text editors.