mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-11 14:04:49 -05:00
Merge pull request #34889 from Krzysztof-Cieslak/file-extension-when
Add `editorFileExtension` when clause context
This commit is contained in:
@@ -23,11 +23,13 @@ export class ResourceContextKey implements IContextKey<URI> {
|
||||
static Filename = new RawContextKey<string>('resourceFilename', undefined);
|
||||
static LangId = new RawContextKey<string>('resourceLangId', undefined);
|
||||
static Resource = new RawContextKey<URI>('resource', undefined);
|
||||
static Extension = new RawContextKey<string>('resourceExtname', undefined);
|
||||
|
||||
private _resourceKey: IContextKey<URI>;
|
||||
private _schemeKey: IContextKey<string>;
|
||||
private _filenameKey: IContextKey<string>;
|
||||
private _langIdKey: IContextKey<string>;
|
||||
private _extensionKey: IContextKey<string>;
|
||||
|
||||
constructor(
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@@ -37,6 +39,7 @@ export class ResourceContextKey implements IContextKey<URI> {
|
||||
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<URI> {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user