Skip to content

Commit

Permalink
Set default accept key to Tab in new version
Browse files Browse the repository at this point in the history
  • Loading branch information
taichimaeda committed Apr 19, 2024
1 parent 0022218 commit f44e885
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/settings/migrators/1.1.0-1.2.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const migrateVersion1_1_0_toVersion1_2_0: SettingsMigrator<
},
usage: settings.usage,
};
// Update if default accept key is still selected.
if (settings.completions.acceptKey === 'Enter') {
newSettings.completions.acceptKey = 'Tab';
}
// Update if default models are still selected.
if (settings.completions.model === 'gpt-3.5-turbo-instruct') {
newSettings.completions.model = 'gpt-3.5-turbo';
Expand Down
3 changes: 3 additions & 0 deletions src/settings/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class SettingsMigrationsRunner {
break;
}
settings = migrator(structuredClone(settings));
if (settings.version === version) {
throw new Error('Settings migration did not update the version');
}
}

this.plugin.settings = settings;
Expand Down

0 comments on commit f44e885

Please sign in to comment.