Skip to content

Commit

Permalink
refactor: show global state value with the debug.clearGlobalState c…
Browse files Browse the repository at this point in the history
…ommand
  • Loading branch information
SpontanCombust committed Jul 22, 2024
1 parent de97b69 commit 75430c9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions editors/vscode/src/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,25 @@ export function commandShowScriptCst(context: vscode.ExtensionContext): Cmd {

export function commandClearGlobalState(context: vscode.ExtensionContext): Cmd {
return async () => {
const keys = context.globalState.keys();
const items: vscode.QuickPickItem[] =
context.globalState.keys()
.map(k => { return {
label: k,
description: context.globalState.get<any>(k).toString()
}});

items.push({
label: 'ALL'
});

const selected = await vscode.window.showQuickPick([...keys, 'ALL']);
const selected = await vscode.window.showQuickPick(items);
if (selected) {
if (selected == 'ALL') {
for (const key of keys) {
if (selected.label == 'ALL') {
for (const key of context.globalState.keys()) {
await context.globalState.update(key, undefined);
}
} else {
await context.globalState.update(selected, undefined);
await context.globalState.update(selected.label, undefined);
}
}
}
Expand Down

0 comments on commit 75430c9

Please sign in to comment.