Add storage support
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { ExtensionContext } from "vscode";
|
||||
|
||||
export enum StorageKey {
|
||||
WorkspaceHistory = 'workspaceHistory'
|
||||
}
|
||||
|
||||
export class StorageManager {
|
||||
private context: ExtensionContext;
|
||||
private storageKey: string = 'githubLocalActions';
|
||||
@@ -12,11 +16,11 @@ export class StorageManager {
|
||||
return this.context.globalState.keys();
|
||||
}
|
||||
|
||||
get<T>(key: string): T | undefined {
|
||||
get<T>(key: StorageKey): T | undefined {
|
||||
return this.context.globalState.get<T>(`${this.storageKey}.${key}`);
|
||||
}
|
||||
|
||||
async update(key: string, value: any): Promise<void> {
|
||||
async update(key: StorageKey, value: any): Promise<void> {
|
||||
await this.context.globalState.update(`${this.storageKey}.${key}`, value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user