Path: blob/main/extensions/markdown-language-features/src/commands/showSource.ts
3294 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as vscode from 'vscode';6import { Command } from '../commandManager';7import { MarkdownPreviewManager } from '../preview/previewManager';89export class ShowSourceCommand implements Command {10public readonly id = 'markdown.showSource';1112public constructor(13private readonly _previewManager: MarkdownPreviewManager14) { }1516public execute() {17const { activePreviewResource, activePreviewResourceColumn } = this._previewManager;18if (activePreviewResource && activePreviewResourceColumn) {19return vscode.workspace.openTextDocument(activePreviewResource).then(document => {20return vscode.window.showTextDocument(document, activePreviewResourceColumn);21});22}23return undefined;24}25}262728