Skip to content

Commit

Permalink
add-resource-dir-name-and-resource-path:
Browse files Browse the repository at this point in the history
add resourceDirName and resourcePath to contextkeys

Signed-off-by: Dan Arad <[email protected]>
  • Loading branch information
danarad05 authored and colin-grant-work committed Jun 17, 2021
1 parent c61e71c commit 55b55ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/src/browser/resource-context-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class ResourceContextKey {
protected resourceFileName: ContextKey<string>;
protected resourceExtname: ContextKey<string>;
protected resourceLangId: ContextKey<string>;
protected resourceDirName: ContextKey<string>;
protected resourcePath: ContextKey<string>;

@postConstruct()
protected init(): void {
Expand All @@ -42,6 +44,8 @@ export class ResourceContextKey {
this.resourceFileName = this.contextKeyService.createKey<string>('resourceFilename', undefined);
this.resourceExtname = this.contextKeyService.createKey<string>('resourceExtname', undefined);
this.resourceLangId = this.contextKeyService.createKey<string>('resourceLangId', undefined);
this.resourceDirName = this.contextKeyService.createKey<string>('resourceDirName', undefined);
this.resourcePath = this.contextKeyService.createKey<string>('resourcePath', undefined);
}

get(): URI | undefined {
Expand All @@ -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 {
Expand All @@ -67,5 +73,4 @@ export class ResourceContextKey {
}
return undefined;
}

}

0 comments on commit 55b55ee

Please sign in to comment.