forked from gitkraken/vscode-gitlens
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hides commands not available in virtual workspaces
- Loading branch information
Showing
8 changed files
with
279 additions
and
213 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { commands } from 'vscode'; | ||
import { ContextKeys, CoreCommands } from './constants'; | ||
|
||
// const contextStorage = new Map<string, unknown>(); | ||
const contextStorage = new Map<string, unknown>(); | ||
|
||
// export function getContext(key: ContextKeys): unknown | undefined { | ||
// return contextStorage.get(key); | ||
// } | ||
export function getContext<T>(key: ContextKeys): T | undefined; | ||
export function getContext<T>(key: ContextKeys, defaultValue: T): T; | ||
export function getContext<T>(key: ContextKeys, defaultValue?: T): T | undefined { | ||
return (contextStorage.get(key) as T | undefined) ?? defaultValue; | ||
} | ||
|
||
export async function setContext( | ||
key: ContextKeys | `${ContextKeys.ActionPrefix}${string}` | `${ContextKeys.KeyPrefix}${string}`, | ||
value: unknown, | ||
): Promise<void> { | ||
// contextStorage.set(key, value); | ||
contextStorage.set(key, value); | ||
void (await commands.executeCommand(CoreCommands.SetContext, key, 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