Finalize markdownstring.baseUri

Fixes #142051
pull/144224/head
Matt Bierner 2022-03-01 15:48:53 -08:00
parent c12c8c1a68
commit a068ebee8d
No known key found for this signature in database
GPG Key ID: 099C331567E11888
6 changed files with 21 additions and 36 deletions

View File

@ -8,7 +8,6 @@
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"enabledApiProposals": [
"markdownStringBaseUri",
"resolvers",
"workspaceTrust"
],

View File

@ -12,7 +12,6 @@
"../../src/vscode-dts/vscode.d.ts",
"../../src/vscode-dts/vscode.proposed.inlayHints.d.ts",
"../../src/vscode-dts/vscode.proposed.languageStatus.d.ts",
"../../src/vscode-dts/vscode.proposed.markdownStringBaseUri.d.ts",
"../../src/vscode-dts/vscode.proposed.resolvers.d.ts",
"../../src/vscode-dts/vscode.proposed.workspaceTrust.d.ts",
]

View File

@ -17,7 +17,6 @@
"findTextInFiles",
"fsChunks",
"inlineCompletions",
"markdownStringBaseUri",
"notebookCellExecutionState",
"notebookConcatTextDocument",
"notebookContentProvider",

View File

@ -25,7 +25,6 @@ export const allApiProposals = Object.freeze({
idToken: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts',
inlineCompletions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts',
ipc: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',
markdownStringBaseUri: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.markdownStringBaseUri.d.ts',
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',
notebookConcatTextDocument: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookConcatTextDocument.d.ts',
notebookContentProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookContentProvider.d.ts',

View File

@ -2660,6 +2660,27 @@ declare module 'vscode' {
*/
supportHtml?: boolean;
/**
* Uri that relative paths are resolved relative to.
*
* If the `baseUri` ends with `/`, it is considered a directory and relative paths in the markdown are resolved relative to that directory:
*
* ```ts
* const md = new vscode.MarkdownString(`[link](./file.js)`);
* md.baseUri = vscode.Uri.file('/path/to/dir/');
* // Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js'
* ```
*
* If the `baseUri` is a file, relative paths in the markdown are resolved relative to the parent dir of that file:
*
* ```ts
* const md = new vscode.MarkdownString(`[link](./file.js)`);
* md.baseUri = vscode.Uri.file('/path/to/otherFile.js');
* // Here 'link' in the rendered markdown resolves to '/path/to/file.js'
* ```
*/
baseUri?: Uri;
/**
* Creates a new markdown string with the given value.
*

View File

@ -1,32 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/142051
interface MarkdownString {
/**
* Uri that relative paths are resolved relative to.
*
* If the `baseUri` ends with `/`, it is considered a directory and relative paths in the markdown are resolved relative to that directory:
*
* ```ts
* const md = new vscode.MarkdownString(`[link](./file.js)`);
* md.baseUri = vscode.Uri.file('/path/to/dir/');
* // Here 'link' in the rendered markdown resolves to '/path/to/dir/file.js'
* ```
*
* If the `baseUri` is a file, relative paths in the markdown are resolved relative to the parent dir of that file:
*
* ```ts
* const md = new vscode.MarkdownString(`[link](./file.js)`);
* md.baseUri = vscode.Uri.file('/path/to/otherFile.js');
* // Here 'link' in the rendered markdown resolves to '/path/to/file.js'
* ```
*/
baseUri?: Uri;
}
}