Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure default persistent values get persisted #13074

Merged
merged 8 commits into from
Dec 19, 2024
5 changes: 5 additions & 0 deletions Extension/src/LanguageServer/persistentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class PersistentStateBase<T> {
this.defaultvalue = defaultValue;
this.state = state;
this.curvalue = defaultValue;

// Ensure the default is written to the state store.
if (this.state && this.state.get<T>(this.key) === undefined) {
void this.state.update(this.key, this.defaultvalue);
}
}

public get Value(): T {
Expand Down
Loading