UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

45 lines • 2.1 kB
import URI from '../common/uri'; import { ContextKeyService, ContextKey } from './context-key-service'; import { LanguageService } from './language-service'; /** * The context key values describing a resource. Each property name is the context key identifier itself, so * the entries can be handed to `ContextKeyService.createOverlay` as they are. */ export interface ResourceContextKeyValues { resource?: string; resourceScheme?: string; resourceFilename?: string; resourceExtname?: string; resourceLangId?: string; resourceDirName?: string; resourcePath?: string; resourceSet: boolean; } export declare class ResourceContextKey { protected readonly languages: LanguageService; protected readonly contextKeyService: ContextKeyService; protected resource: ContextKey<string>; protected resourceSchemeKey: ContextKey<string>; protected resourceFileName: ContextKey<string>; protected resourceExtname: ContextKey<string>; protected resourceLangId: ContextKey<string>; protected resourceDirName: ContextKey<string>; protected resourcePath: ContextKey<string>; protected resourceSet: ContextKey<boolean>; protected init(): void; /** * Constrains the key name to the value properties, whose names are the context key identifiers, so that * the keys this class creates and the ones it describes a resource with cannot drift apart. */ protected createResourceKey<K extends keyof ResourceContextKeyValues>(name: K, defaultValue?: NonNullable<ResourceContextKeyValues[K]>): ContextKey<NonNullable<ResourceContextKeyValues[K]>>; get(): string | undefined; set(resourceUri: URI | undefined): void; /** * The values describing `resourceUri`, without applying them to the context. * * @param resourceUri the resource to describe, or `undefined` to obtain the values of an unset resource. */ toValues(resourceUri: URI | undefined): ResourceContextKeyValues; protected getLanguageId(uri: URI | undefined): string | undefined; } //# sourceMappingURL=resource-context-key.d.ts.map