File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,11 @@ func (m *ViolationResultTableModel) setupFileWatcher() tea.Cmd {
6363 return nil
6464 }
6565
66- err = m .watcher .Add (absPath )
66+ // Watch the directory instead of the specific file to handle atomic saves
67+ watchDir := filepath .Dir (absPath )
68+ err = m .watcher .Add (watchDir )
6769 if err != nil {
68- m .watchError = fmt .Sprintf ("Failed to watch file %s: %v" , absPath , err )
70+ m .watchError = fmt .Sprintf ("Failed to watch directory %s: %v" , watchDir , err )
6971 m .watchState = WatchStateError
7072 return nil
7173 }
@@ -86,7 +88,13 @@ func (m *ViolationResultTableModel) watchFileChanges() {
8688 return
8789 }
8890
89- if event .Has (fsnotify .Write ) || event .Has (fsnotify .Rename ) {
91+ // Only process events for our target file
92+ targetFile := m .watchedFiles [0 ] // The absolute path of our spec file
93+ if event .Name != targetFile {
94+ continue
95+ }
96+
97+ if event .Has (fsnotify .Write ) || event .Has (fsnotify .Rename ) || event .Has (fsnotify .Create ) {
9098 select {
9199 case m .watchMsgChan <- fileChangeMsg {fileName : event .Name }:
92100 default :
You can’t perform that action at this time.
0 commit comments