Skip to content

Commit

Permalink
simplify LanguageOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Feb 4, 2024
1 parent 2c8a92a commit c1d2197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions ext/js/pages/settings/languages-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export class LanguagesController {
async _updateOptions() {
const options = await this._settingsController.getOptions();
const {general: {language}} = options;

if (!options.languages[language]) {
/** @type {import('settings').LanguageOptions} */
const defaultOptions = {
textPreprocessors: {}
};
await this._settingsController.modifyProfileSettings([{
action: 'set',
path: 'languages',
value: {
...options.languages,
[language]: {
textPreprocessors: {}
}
}
path: `languages[${JSON.stringify(language)}]`,
value: defaultOptions
}]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion types/ext/settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export type TextPreprocessorsOptions = {
};

export type LanguageOptions = {
textPreprocessors?: TextPreprocessorsOptions;
textPreprocessors: TextPreprocessorsOptions;
};

export type LanguageOptionsObjectMap = {
Expand Down

0 comments on commit c1d2197

Please sign in to comment.