This repository was archived by the owner on Dec 29, 2022. It is now read-only.
File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,8 @@ impl<'ctx> FileWatch<'ctx> {
240
240
}
241
241
242
242
/// Returns if a file change is relevant to the files we actually wanted to watch
243
+ // Implementation note: This is expected to be called a large number of times in a loop
244
+ // so should be fast / avoid allocation.
243
245
#[ inline]
244
246
pub fn is_relevant ( & self , change : & FileEvent ) -> bool {
245
247
let path = change. uri . as_str ( ) ;
@@ -250,7 +252,7 @@ impl<'ctx> FileWatch<'ctx> {
250
252
251
253
let local = & path[ self . project_uri . len ( ) ..] ;
252
254
253
- local == "/Cargo.lock" || local == "Cargo.toml"
255
+ local == "/Cargo.lock" || local == "/ Cargo.toml"
254
256
|| local == "/target" && change. typ == FileChangeType :: Deleted
255
257
}
256
258
}
Original file line number Diff line number Diff line change @@ -277,13 +277,10 @@ impl<'a> NotificationAction<'a> for DidChangeWatchedFiles {
277
277
let ctx = ctx. inited ( ) ;
278
278
let file_watch = FileWatch :: new ( & ctx) ;
279
279
280
- // ignore irrelevant files from more spammy clients
281
- if !params. changes . iter ( ) . any ( |c| file_watch. is_relevant ( c) ) {
282
- return Ok ( ( ) ) ;
280
+ if params. changes . iter ( ) . any ( |c| file_watch. is_relevant ( c) ) {
281
+ ctx. build_current_project ( BuildPriority :: Cargo , out) ;
283
282
}
284
283
285
- ctx. build_current_project ( BuildPriority :: Cargo , out) ;
286
-
287
284
Ok ( ( ) )
288
285
}
289
286
}
You can’t perform that action at this time.
0 commit comments