()
| 752 | } |
| 753 | |
| 754 | private async writeSettingsDataOnlyOnce(): Promise<void> { |
| 755 | if (this.settingsLoadCompromised) { |
| 756 | tasknotesLogger.warn( |
| 757 | "[TaskNotes] Skipping settings save because settings data could not be read safely during startup.", |
| 758 | { |
| 759 | category: "configuration", |
| 760 | operation: "skipping-settings-save-because-settings-data-read-safely-startup", |
| 761 | } |
| 762 | ); |
| 763 | return; |
| 764 | } |
| 765 | |
| 766 | // Load existing plugin data to preserve non-settings data like pomodoroHistory |
| 767 | const loadedData = await this.loadData(); |
| 768 | if (loadedData === null && (await this.pluginDataFileExists())) { |
| 769 | this.settingsLoadCompromised = true; |
| 770 | tasknotesLogger.warn( |
| 771 | "[TaskNotes] Skipping settings save because data.json exists but could not be read.", |
| 772 | { |
| 773 | category: "configuration", |
| 774 | operation: "skipping-settings-save-because-data-json-exists-but-read", |
| 775 | } |
| 776 | ); |
| 777 | return; |
| 778 | } |
| 779 | |
| 780 | const data = loadedData || {}; |
| 781 | await this.saveData(buildSettingsDataForSave(data, this.settings)); |
| 782 | } |
| 783 | |
| 784 | async onExternalSettingsChange(): Promise<void> { |
| 785 | await this.settingsLifecycleService.onExternalSettingsChange(); |
no test coverage detected