fix(editor): synchronize external file changes on focus (#564)

Open files only reloaded from file watcher events, so a change the watcher skipped stayed stale in its tab: excluded and git-ignored folders, files outside the project, and missed events.

- Re-check open documents against disk when the window gains focus, off the UI thread and debounced. Clean documents reload, dirty ones keep the existing warning, and unchanged ones cost one metadata call.
- Refresh the project tree and Git status on the same focus event.
- Add "Synchronize external changes when switching to the IDE window" under System Settings, on by default.

Fixes #563
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-10-31 20:12:00 +08:00
1 джерело 4796265b5c
коміт 17e3cd2b39
18 files changed
+510

No files matched your search

+6
Переглянути файл
@@ -50,6 +50,12 @@ pub async fn doc_save_all(window: Window, state: State<'_, AppState>) -> IdeResu
ide_host::ops::doc::save_all(&state.host, window.label()).await
}
#[tauri::command]
#[specta::specta]
pub async fn doc_sync_from_disk(window: Window, state: State<'_, AppState>) -> IdeResult<()> {
ide_host::ops::doc::sync_from_disk(&state.host, window.label()).await
}
#[tauri::command]
#[specta::specta]
pub async fn doc_snapshot(window: Window, state: State<'_, AppState>, doc: DocId) -> IdeResult<DocumentInfo> {
+1
Переглянути файл
@@ -143,6 +143,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
doc::doc_edit,
doc::doc_save,
doc::doc_save_all,
doc::doc_sync_from_disk,
doc::doc_snapshot,
doc::doc_ui_mode,
doc::doc_set_encoding,