fix(lazy-mode): Save lazy mode in local storage after getting not supported message (@Leonabcd123) (#7171)

### Description

Save lazy mode status in local storage after getting the "This language
does not support lazy mode" message. This is so the user doesn't get the
same message every time they refresh, and it matches up with the
settings that show that lazy mode is disabled even though it's enabled
in local storage.
This commit is contained in:
Leonabcd123 2025-12-10 21:09:30 +02:00 committed by GitHub
parent 6d8ef91155
commit de4e872996
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -400,6 +400,7 @@ export function restart(options = {} as RestartOptions): void {
let lastInitError: Error | null = null;
let rememberLazyMode: boolean;
let showedLazyModeNotification: boolean = false;
let testReinitCount = 0;
async function init(): Promise<boolean> {
@ -494,7 +495,7 @@ async function init(): Promise<boolean> {
important: true,
},
);
UpdateConfig.setLazyMode(false, true);
UpdateConfig.setLazyMode(false, false);
} else if (rememberLazyMode && anySupportsLazyMode) {
UpdateConfig.setLazyMode(true, true);
}
@ -502,10 +503,12 @@ async function init(): Promise<boolean> {
// normal mode
if (Config.lazyMode && !allowLazyMode) {
rememberLazyMode = true;
showedLazyModeNotification = true;
Notifications.add("This language does not support lazy mode.", 0, {
important: true,
});
UpdateConfig.setLazyMode(false, true);
UpdateConfig.setLazyMode(false, false);
} else if (rememberLazyMode && !language.noLazyMode) {
UpdateConfig.setLazyMode(true, true);
}
@ -1627,7 +1630,10 @@ ConfigEvent.subscribe((eventKey, eventValue, nosave) => {
ArabicLazyMode.set(eventValue as boolean);
}
if (eventValue === false) {
rememberLazyMode = false;
if (!showedLazyModeNotification) {
rememberLazyMode = false;
}
showedLazyModeNotification = false;
}
}
});