Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Dec 11, 2023
1 parent c7bcf64 commit 6edd8ad
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export class VscodeCommandHistory implements CommandRunnerDecorator {
extensionContext: vscode.ExtensionContext,
fileSystem: FileSystem,
) {
this.evaluateSetting = this.evaluateSetting.bind(this);
this.cursorlessVersion = extensionContext.extension.packageJSON.version;
this.dirPath = path.join(fileSystem.cursorlessDir, dirName);

// Read initial setting value. The watcher below will take care of changes.
this.evaluateSetting();

this.disposable = vscode.workspace.onDidChangeConfiguration((event) => {
Expand All @@ -49,9 +49,10 @@ export class VscodeCommandHistory implements CommandRunnerDecorator {
if (!this.active) {
return runner;
}

return {
run: async (commandComplete: CommandComplete) => {
void this.append(commandComplete);
await this.append(commandComplete);

return await runner.run(commandComplete);
},
Expand All @@ -76,19 +77,18 @@ export class VscodeCommandHistory implements CommandRunnerDecorator {
}

private evaluateSetting() {
this.active =
vscode.workspace
.getConfiguration(settingSection)
.get<boolean>(settingName) ?? false;
this.active = vscode.workspace
.getConfiguration(settingSection)
.get<boolean>(settingName, false);
}

dispose() {
this.disposable.dispose();
}
}

// Remove spoken form and sanitize action
function sanitizeCommand(command: CommandComplete): CommandComplete {
// Remove spoken form and sanitize action
const { spokenForm, action, ...rest } = command;
return {
...rest,
Expand Down

0 comments on commit 6edd8ad

Please sign in to comment.