-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #144 from olasunkanmi-SE/ai-agents
Improve type safety and reusability in BaseEmitter
- development
- (#126, #144)
Showing
12 changed files
with
321 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as vscode from "vscode"; | ||
import { Logger } from "../logger/logger"; | ||
|
||
export class LocalStorageManager { | ||
private readonly localStorage: vscode.SecretStorage; | ||
private readonly logger: Logger; | ||
constructor(context: vscode.ExtensionContext) { | ||
this.localStorage = context.secrets; | ||
this.logger = new Logger("localStorageManager"); | ||
this.localStorage.onDidChange(this.handleOnChange.bind(this)); | ||
} | ||
|
||
async add(key: string, value: string): Promise<void> { | ||
await this.localStorage.store(key, value); | ||
} | ||
|
||
async get(key: string): Promise<string | undefined> { | ||
return await this.localStorage.get(key); | ||
} | ||
|
||
async delete(key: string) { | ||
await this.localStorage.delete(key); | ||
} | ||
|
||
async handleOnChange(event: vscode.SecretStorageChangeEvent) { | ||
const value = await this.localStorage.get(event.key); | ||
this.logger.info(`Key: ${event.key}, Value: ${value}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters