mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
refactor: improve file change handling in input loop
This commit is contained in:
parent
7587d76fd1
commit
1261a335f4
1 changed files with 5 additions and 5 deletions
10
aider/io.py
10
aider/io.py
|
@ -373,9 +373,8 @@ class InputOutput:
|
||||||
for changed in watch_source_files(
|
for changed in watch_source_files(
|
||||||
root, stop_event=stop_event, gitignores=gitignore
|
root, stop_event=stop_event, gitignores=gitignore
|
||||||
):
|
):
|
||||||
dump(changed)
|
|
||||||
if changed:
|
if changed:
|
||||||
self.changed_files = list(changed)[0] # Take the first changed file
|
self.changed_files = list(changed)
|
||||||
self.interrupt_input()
|
self.interrupt_input()
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -384,7 +383,6 @@ class InputOutput:
|
||||||
# Start the watcher thread
|
# Start the watcher thread
|
||||||
watcher = threading.Thread(target=watch_files, daemon=True)
|
watcher = threading.Thread(target=watch_files, daemon=True)
|
||||||
watcher.start()
|
watcher.start()
|
||||||
dump(watcher)
|
|
||||||
|
|
||||||
rel_fnames = list(rel_fnames)
|
rel_fnames = list(rel_fnames)
|
||||||
show = ""
|
show = ""
|
||||||
|
@ -441,11 +439,13 @@ class InputOutput:
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
line = input(show)
|
line = input(show)
|
||||||
|
|
||||||
|
dump(line)#
|
||||||
# Check if we were interrupted by a file change
|
# Check if we were interrupted by a file change
|
||||||
if self.changed_files:
|
if self.changed_files:
|
||||||
changed = self.changed_files
|
changed = ' '.join(self.changed_files)
|
||||||
self.changed_files = None
|
self.changed_files = None
|
||||||
dump(changed)
|
|
||||||
return f"/add {changed}" # Return an edit command for the changed file
|
return f"/add {changed}" # Return an edit command for the changed file
|
||||||
except EOFError:
|
except EOFError:
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue