mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
Use id for markdown open document link command uir
This commit is contained in:
@@ -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> {
|
||||||
|
|||||||
Reference in New Issue
Block a user