Skip to content

Commit

Permalink
fix: handle error when lsp watch init failed (#1866)
Browse files Browse the repository at this point in the history
Signed-off-by: he1pa <18012015693@163.com>
  • Loading branch information
He1pa authored Feb 24, 2025
1 parent 4fe69c6 commit f3b018f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kclvm/tools/src/LSP/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,10 @@ impl LanguageServerState {
for folder in workspace_folders {
let path = file_path_from_url(&folder.uri).unwrap();
let mut watcher = &mut self.fs_event_watcher.handle;
watcher
.watch(std::path::Path::new(&path), RecursiveMode::Recursive)
.unwrap();
match watcher.watch(std::path::Path::new(&path), RecursiveMode::Recursive) {
Ok(_) => self.log_message(format!("Start watch {:?}", path)),
Err(e) => self.log_message(format!("Failed watch {:?}: {:?}", path, e)),
}
self.log_message(format!("Start watch {:?}", path));
let tool = Arc::clone(&self.tool);
let (workspaces, failed) = lookup_compile_workspaces(&*tool.read(), &path, true);
Expand Down

0 comments on commit f3b018f

Please sign in to comment.