From ea9b7a9c9c342fbbd459a39ebbb2756920bc20e3 Mon Sep 17 00:00:00 2001 From: ifengqi <362254883@qq.com> Date: Tue, 24 Sep 2024 16:30:16 +0800 Subject: [PATCH] 1. Fix the PathBuf value in file monitoring events in the Windows environment (#3538) --- lapce-proxy/src/dispatch.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lapce-proxy/src/dispatch.rs b/lapce-proxy/src/dispatch.rs index 6a06d50f..3f9e94a8 100644 --- a/lapce-proxy/src/dispatch.rs +++ b/lapce-proxy/src/dispatch.rs @@ -1266,8 +1266,19 @@ fn handle_fs_events(&self, events: Vec<(WatchToken, notify::Event)>) { } fn handle_open_file_fs_event(&self, event: notify::Event) { + const PREFIX: &str = r"\\?\"; if event.kind.is_modify() { for path in event.paths { + #[cfg(windows)] + if let Some(path_str) = path.to_str() { + if path_str.starts_with(PREFIX) { + let path = PathBuf::from(&path_str[PREFIX.len()..]); + self.proxy_rpc.notification( + ProxyNotification::OpenFileChanged { path }, + ); + continue; + } + } self.proxy_rpc .notification(ProxyNotification::OpenFileChanged { path }); }