Skip to content

Commit

Permalink
Watch folders instead of files
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed May 18, 2021
1 parent 86a7cc8 commit a7ea0d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/workspace/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ impl<W: Workspace> Workspace for DocumentWatcher<W> {
) -> Arc<Document> {
let document = self.workspace.open(uri, text, language, source);
if document.uri.scheme() == "file" {
if let Ok(path) = document.uri.to_file_path() {
if let Ok(mut path) = document.uri.to_file_path() {
path.pop();
let mut watched_paths = self.watched_paths.lock().unwrap();
if !watched_paths.contains(&path) {
if let Err(why) = self
Expand All @@ -64,7 +65,10 @@ impl<W: Workspace> Workspace for DocumentWatcher<W> {
.unwrap()
.watch(&path, RecursiveMode::NonRecursive)
{
warn!("Failed to watch document \"{}\": {}", document.uri, why);
warn!(
"Failed to watch folder of document \"{}\": {}",
document.uri, why
);
}
watched_paths.insert(path);
}
Expand Down

0 comments on commit a7ea0d5

Please sign in to comment.