File tree 1 file changed +12
-5
lines changed 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -425,16 +425,23 @@ func basename(filename string) string {
425
425
}
426
426
427
427
func (v * view ) relevantChange (c source.FileModification ) bool {
428
- if v .contains (c .URI ) {
429
- return true
428
+ // If the file is known to the view, the change is relevant.
429
+ known := v .knownFile (c .URI )
430
+
431
+ // If the file is not known to the view, and the change is only on-disk,
432
+ // we should not invalidate the snapshot. This is necessary because Emacs
433
+ // sends didChangeWatchedFiles events for temp files.
434
+ if ! known && c .OnDisk && (c .Action == source .Change || c .Action == source .Delete ) {
435
+ return false
430
436
}
437
+ return v .contains (c .URI ) || known
438
+ }
431
439
432
- // Check if the view is already aware of this file.
433
- // If so, the change is relevant.
440
+ func (v * view ) knownFile (uri span.URI ) bool {
434
441
v .mu .Lock ()
435
442
defer v .mu .Unlock ()
436
443
437
- f , err := v .findFile (c . URI )
444
+ f , err := v .findFile (uri )
438
445
return f != nil && err == nil
439
446
}
440
447
You can’t perform that action at this time.
0 commit comments