Use id for markdown open document link command uir

This commit is contained in:
Matt Bierner
2017-12-06 13:20:16 -08:00
parent daf63a3ad1
commit 6c4ed74ac4
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -240,7 +240,8 @@ export interface OpenDocumentLinkArgs {
} }
export class OpenDocumentLinkCommand implements Command { export class OpenDocumentLinkCommand implements Command {
public readonly id = '_markdown.openDocumentLink'; public static readonly id = '_markdown.openDocumentLink';
public readonly id = OpenDocumentLinkCommand.id;
public constructor( public constructor(
private readonly engine: MarkdownEngine private readonly engine: MarkdownEngine
@@ -7,6 +7,7 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as path from 'path'; import * as path from 'path';
import { OpenDocumentLinkCommand } from '../commands';
function normalizeLink(document: vscode.TextDocument, link: string, base: string): vscode.Uri { function normalizeLink(document: vscode.TextDocument, link: string, base: string): vscode.Uri {
const uri = vscode.Uri.parse(link); const uri = vscode.Uri.parse(link);
@@ -27,7 +28,7 @@ function normalizeLink(document: vscode.TextDocument, link: string, base: string
resourcePath = path.join(base, uri.path); resourcePath = path.join(base, uri.path);
} }
return vscode.Uri.parse(`command:_markdown.openDocumentLink?${encodeURIComponent(JSON.stringify({ fragment: uri.fragment, path: resourcePath }))}`); return vscode.Uri.parse(`command:${OpenDocumentLinkCommand.id}?${encodeURIComponent(JSON.stringify({ fragment: uri.fragment, path: resourcePath }))}`);
} }
function matchAll(pattern: RegExp, text: string): Array<RegExpMatchArray> { function matchAll(pattern: RegExp, text: string): Array<RegExpMatchArray> {