UNPKG

@theia/workspace

Version:
81 lines 3.47 kB
/******************************************************************************** * Copyright (C) 2026 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 ********************************************************************************/ import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { ILogger, Emitter, Event, Disposable, DisposableCollection, URI } from '@theia/core/lib/common'; import { WorkspaceService } from '../workspace-service'; /** * Represents a metadata store for a specific key within a workspace. * The store provides access to a dedicated directory for storing workspace-specific metadata. */ export interface WorkspaceMetadataStore extends Disposable { /** * The key identifying this metadata store. */ readonly key: string; /** * The URI location of the metadata store directory. */ readonly location: URI; /** * Event that fires when the location of the metadata store changes. * It is the client's responsibility to reload or reinitialize any metadata from * or in the new location. */ readonly onDidChangeLocation: Event<URI>; /** * Ensures that the metadata store directory exists on disk. * Creates the directory if it doesn't exist. */ ensureExists(): Promise<void>; /** * Deletes the metadata store directory and all of its contents. */ delete(): Promise<void>; } /** * Implementation of WorkspaceMetadataStore. * @internal */ export declare class WorkspaceMetadataStoreImpl implements WorkspaceMetadataStore { protected readonly fileService: FileService; protected readonly workspaceService: WorkspaceService; protected readonly logger: ILogger; protected readonly toDispose: DisposableCollection; protected readonly onDidChangeLocationEmitter: Emitter<URI>; readonly onDidChangeLocation: Event<URI>; protected _location: URI; protected _key: string; protected currentWorkspaceRoot?: URI; protected locationProvider: () => Promise<URI>; protected onDisposeCallback?: () => void; get location(): URI; get key(): string; /** * Initializes the WorkspaceMetadataStore. * @param key The key identifying this store * @param initialLocation The initial location URI * @param locationProvider Function to resolve the current location based on workspace changes * @param onDispose Callback invoked when the store is disposed */ initialize(key: string, initialLocation: URI, locationProvider: () => Promise<URI>, onDispose?: () => void): void; protected init(): void; protected handleWorkspaceChange(): Promise<void>; protected getFirstWorkspaceRoot(): URI | undefined; ensureExists(): Promise<void>; delete(): Promise<void>; dispose(): void; } //# sourceMappingURL=workspace-metadata-store.d.ts.map