Skip to content

Commit

Permalink
Merge pull request #300 from andersjanmyr/fix_need_to_save_twice_to_t…
Browse files Browse the repository at this point in the history
…rigger_watch

Fix need to save twice to trigger watch on OSX using Neovim
  • Loading branch information
dnephin authored Feb 8, 2023
2 parents 031d3c8 + 50971a6 commit f39e7fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/filewatcher/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ type fsEventHandler struct {
var floodThreshold = 250 * time.Millisecond

func (h *fsEventHandler) handleEvent(event fsnotify.Event) error {
if event.Op&(fsnotify.Write|fsnotify.Create) == 0 {
if event.Op&(fsnotify.Write|fsnotify.Create|fsnotify.Rename) == 0 {
return nil
}

Expand Down
5 changes: 3 additions & 2 deletions internal/filewatcher/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ func TestFSEventHandler_HandleEvent(t *testing.T) {

var testCases = []testCase{
{
name: "Op is rename",
event: fsnotify.Event{Op: fsnotify.Rename, Name: "file_test.go"},
name: "Op is rename",
event: fsnotify.Event{Op: fsnotify.Rename, Name: "file_test.go"},
expectedRun: true,
},
{
name: "Op is remove",
Expand Down

0 comments on commit f39e7fa

Please sign in to comment.