Skip to content

Commit f3b018f

Browse files
authored
fix: handle error when lsp watch init failed (#1866)
Signed-off-by: he1pa <[email protected]>
1 parent 4fe69c6 commit f3b018f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kclvm/tools/src/LSP/src/state.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,10 @@ impl LanguageServerState {
574574
for folder in workspace_folders {
575575
let path = file_path_from_url(&folder.uri).unwrap();
576576
let mut watcher = &mut self.fs_event_watcher.handle;
577-
watcher
578-
.watch(std::path::Path::new(&path), RecursiveMode::Recursive)
579-
.unwrap();
577+
match watcher.watch(std::path::Path::new(&path), RecursiveMode::Recursive) {
578+
Ok(_) => self.log_message(format!("Start watch {:?}", path)),
579+
Err(e) => self.log_message(format!("Failed watch {:?}: {:?}", path, e)),
580+
}
580581
self.log_message(format!("Start watch {:?}", path));
581582
let tool = Arc::clone(&self.tool);
582583
let (workspaces, failed) = lookup_compile_workspaces(&*tool.read(), &path, true);

0 commit comments

Comments
 (0)