Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/markdown-language-features/src/commands/showSource.ts
3294 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as vscode from 'vscode';
7
import { Command } from '../commandManager';
8
import { MarkdownPreviewManager } from '../preview/previewManager';
9
10
export class ShowSourceCommand implements Command {
11
public readonly id = 'markdown.showSource';
12
13
public constructor(
14
private readonly _previewManager: MarkdownPreviewManager
15
) { }
16
17
public execute() {
18
const { activePreviewResource, activePreviewResourceColumn } = this._previewManager;
19
if (activePreviewResource && activePreviewResourceColumn) {
20
return vscode.workspace.openTextDocument(activePreviewResource).then(document => {
21
return vscode.window.showTextDocument(document, activePreviewResourceColumn);
22
});
23
}
24
return undefined;
25
}
26
}
27
28