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 @@ -392,16 +392,23 @@ func basename(filename string) string {
392
392
}
393
393
394
394
func (v * view ) relevantChange (c source.FileModification ) bool {
395
- if v .contains (c .URI ) {
396
- return true
395
+ // If the file is known to the view, the change is relevant.
396
+ known := v .knownFile (c .URI )
397
+
398
+ // If the file is not known to the view, and the change is only on-disk,
399
+ // we should not invalidate the snapshot. This is necessary because Emacs
400
+ // sends didChangeWatchedFiles events for temp files.
401
+ if ! known && c .OnDisk && (c .Action == source .Change || c .Action == source .Delete ) {
402
+ return false
397
403
}
404
+ return v .contains (c .URI ) || known
405
+ }
398
406
399
- // Check if the view is already aware of this file.
400
- // If so, the change is relevant.
407
+ func (v * view ) knownFile (uri span.URI ) bool {
401
408
v .mu .Lock ()
402
409
defer v .mu .Unlock ()
403
410
404
- f , err := v .findFile (c . URI )
411
+ f , err := v .findFile (uri )
405
412
return f != nil && err == nil
406
413
}
407
414
You can’t perform that action at this time.
0 commit comments