diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts index 34b7d02d84699..ec82d07b99be6 100644 --- a/src/vs/workbench/common/resources.ts +++ b/src/vs/workbench/common/resources.ts @@ -23,11 +23,13 @@ export class ResourceContextKey implements IContextKey { static Filename = new RawContextKey('resourceFilename', undefined); static LangId = new RawContextKey('resourceLangId', undefined); static Resource = new RawContextKey('resource', undefined); + static Extension = new RawContextKey('resourceExtname', undefined); private _resourceKey: IContextKey; private _schemeKey: IContextKey; private _filenameKey: IContextKey; private _langIdKey: IContextKey; + private _extensionKey: IContextKey; constructor( @IContextKeyService contextKeyService: IContextKeyService, @@ -37,6 +39,7 @@ export class ResourceContextKey implements IContextKey { this._filenameKey = ResourceContextKey.Filename.bindTo(contextKeyService); this._langIdKey = ResourceContextKey.LangId.bindTo(contextKeyService); this._resourceKey = ResourceContextKey.Resource.bindTo(contextKeyService); + this._extensionKey = ResourceContextKey.Extension.bindTo(contextKeyService); } set(value: URI) { @@ -44,12 +47,14 @@ export class ResourceContextKey implements IContextKey { this._schemeKey.set(value && value.scheme); this._filenameKey.set(value && basename(value.fsPath)); this._langIdKey.set(value && this._modeService.getModeIdByFilenameOrFirstLine(value.fsPath)); + this._extensionKey.set(value && paths.extname(value.fsPath)); } reset(): void { this._schemeKey.reset(); this._langIdKey.reset(); this._resourceKey.reset(); + this._extensionKey.reset(); } public get(): URI {