Repository navigation
feat: add autoReloadOnFileChange preference - #5325
Closed
dronov-dmitry wants to merge 5 commits into
Closed
dronov-dmitry wants to merge 5 commits into
dronov-dmitry wants to merge 5 commits into
Conversation
Add a new internal preference 'autoReloadOnFileChange' (default: false) that automatically reloads file content when changed on disk by an external process, bypassing the confirmation dialog. When enabled, the file is reloaded immediately regardless of autoSave state. When disabled (default), existing behavior is preserved: - autoSave enabled + file saved → auto-reload - otherwise → show confirmation dialog
The autoReloadOnFileChange preference was not being saved/loaded properly. On startup, Preference.init() compares user settings with preference.json using hasSameKeys(). Since autoReloadOnFileChange was missing from preference.json, it was treated as an outdated key and deleted from the user's saved settings, then re-added with the default value of false. Added autoReloadOnFileChange: false to preference.json so the key is recognized and the user's saved value is preserved across app restarts.
Member
|
dup with #5174 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new preference
autoReloadOnFileChange(default:false) that automatically reloads file content when changed on disk by an external process, bypassing the confirmation dialog.Demo
🎬 Video demo
Changes
autoReloadOnFileChangeboolean preferenceIUserPreferencesLISTEN_FOR_FILE_CHANGE()— when enabled, reloads immediately without dialog regardless of autoSave stateBehavior
Why this change?
When working with files that are frequently updated by external processes (server sync, git pull, live-reloading tools), the constant "File was changed on disk. Do you want to reload it?" dialog is disruptive. This setting allows the user to opt into silent auto-reloading.
Persistence fix
Initially the
autoReloadOnFileChangepreference did not survive app restarts. The root cause:Preference.init()in the main process compares saved user settings againststatic/preference.jsonusinghasSameKeys(). Since the new key was missing frompreference.json, it was treated as an outdated key and deleted, then re-added with the defaultfalse. Fixed by addingautoReloadOnFileChange: falsetopreference.json.Testing
echo test >> file.md)