Enable toggle md preview in modals/agents

This commit is contained in:
Matt Bierner
2026-04-30 12:38:57 -07:00
parent d94ab677a2
commit 7e5d09bf3f
2 changed files with 13 additions and 2 deletions

View File

@@ -263,6 +263,16 @@
"when": "editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",
"alt": "markdown.showPreview",
"group": "navigation"
},
{
"command": "markdown.reopenAsPreview",
"when": "activeEditor == workbench.editors.files.textFileEditor && resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",
"group": "navigation"
},
{
"command": "markdown.reopenAsSource",
"when": "activeCustomEditorId == 'vscode.markdown.preview.editor'",
"group": "navigation"
}
],
"explorer/context": [

View File

@@ -66,9 +66,10 @@ function getCommandsContext(commandArgs: unknown[], editorService: IEditorServic
// Get editor context for which the command was triggered
let editorContext = getEditorContextFromCommandArgs(commandArgs, isListAction, editorService, editorGroupsService, listService);
// If the editor context can not be determind use the active editor
// If the editor context can not be determined use the active editor
if (!editorContext) {
const activeGroup = editorGroupsService.activeGroup;
const modalEditorPart = editorGroupsService.activeModalEditorPart;
const activeGroup = modalEditorPart?.activeGroup ?? editorGroupsService.activeGroup;
const activeEditor = activeGroup.activeEditor;
editorContext = { groupId: activeGroup.id, editorIndex: activeEditor ? activeGroup.getIndexOfEditor(activeEditor) : undefined };
isListAction = false;