Skip to content

Commit

Permalink
improved function that runs code with modified config to properly res…
Browse files Browse the repository at this point in the history
…tore former value
  • Loading branch information
riccardoferretti committed Aug 17, 2023
1 parent 5a049ca commit a194e29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/foam-vscode/src/test/test-utils-vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export const runCommand = async <T>(command: string, args: T = undefined) =>
* @param fn the function to execute
*/
export const withModifiedConfiguration = async (key, value, fn: () => void) => {
const old = vscode.workspace.getConfiguration().get(key);
const old = vscode.workspace.getConfiguration().inspect(key);
await vscode.workspace.getConfiguration().update(key, value);
await fn();
await vscode.workspace.getConfiguration().update(key, old);
await vscode.workspace.getConfiguration().update(key, old.workspaceValue);
};

/**
Expand Down

0 comments on commit a194e29

Please sign in to comment.