From b4eb9933a45aba1d5d74ccbde425dc524d88546a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 6 Feb 2020 15:48:16 +0100 Subject: [PATCH] add asExtensionUri-api proposal --- src/vs/vscode.proposed.d.ts | 15 +++++++++++++++ .../api/common/extHostExtensionService.ts | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 4f3e3e1f214..4aea3fcfb69 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1623,4 +1623,19 @@ declare module 'vscode' { } //#endregion + + + //#region + + export interface ExtensionContext { + /** + * Get the uri of a resource contained in the extension. + * + * @param relativePath A relative path to a resource contained in the extension. + * @return The uri of the resource. + */ + asExtensionUri(relativePath: string): Uri; + } + + //#endregion } diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts index 978bf32fcda..16f5e3bca7a 100644 --- a/src/vs/workbench/api/common/extHostExtensionService.ts +++ b/src/vs/workbench/api/common/extHostExtensionService.ts @@ -369,7 +369,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio get extensionPath() { return extensionDescription.extensionLocation.fsPath; }, get storagePath() { return that._storagePath.workspaceValue(extensionDescription); }, get globalStoragePath() { return that._storagePath.globalValue(extensionDescription); }, - asAbsolutePath: (relativePath: string) => { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); }, + asAbsolutePath(relativePath: string) { return path.join(extensionDescription.extensionLocation.fsPath, relativePath); }, + asExtensionUri(relativePath: string) { return joinPath(extensionDescription.extensionLocation, relativePath); }, get logPath() { return path.join(that._initData.logsLocation.fsPath, extensionDescription.identifier.value); } }); }); -- GitLab