From 55b55eec6af8b50ae61fc21bc0cd46a6c52d3272 Mon Sep 17 00:00:00 2001 From: Dan Arad Date: Thu, 20 May 2021 11:53:32 +0300 Subject: [PATCH] add-resource-dir-name-and-resource-path: add resourceDirName and resourcePath to contextkeys Signed-off-by: Dan Arad --- packages/core/src/browser/resource-context-key.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/src/browser/resource-context-key.ts b/packages/core/src/browser/resource-context-key.ts index 2929eea91a302..31948c9070890 100644 --- a/packages/core/src/browser/resource-context-key.ts +++ b/packages/core/src/browser/resource-context-key.ts @@ -34,6 +34,8 @@ export class ResourceContextKey { protected resourceFileName: ContextKey; protected resourceExtname: ContextKey; protected resourceLangId: ContextKey; + protected resourceDirName: ContextKey; + protected resourcePath: ContextKey; @postConstruct() protected init(): void { @@ -42,6 +44,8 @@ export class ResourceContextKey { this.resourceFileName = this.contextKeyService.createKey('resourceFilename', undefined); this.resourceExtname = this.contextKeyService.createKey('resourceExtname', undefined); this.resourceLangId = this.contextKeyService.createKey('resourceLangId', undefined); + this.resourceDirName = this.contextKeyService.createKey('resourceDirName', undefined); + this.resourcePath = this.contextKeyService.createKey('resourcePath', undefined); } get(): URI | undefined { @@ -55,6 +59,8 @@ export class ResourceContextKey { this.resourceFileName.set(resourceUri && resourceUri.path.base); this.resourceExtname.set(resourceUri && resourceUri.path.ext); this.resourceLangId.set(resourceUri && this.getLanguageId(resourceUri)); + this.resourceDirName.set(resourceUri && Uri.parse(resourceUri.path.dir.toString()).fsPath); + this.resourcePath.set(resourceUri && resourceUri['codeUri'].fsPath); } protected getLanguageId(uri: URI | undefined): string | undefined { @@ -67,5 +73,4 @@ export class ResourceContextKey { } return undefined; } - }