mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: Add support for dropping read-only files in /drop command
This commit is contained in:
parent
f9bc52daea
commit
d0afacd745
1 changed files with 9 additions and 2 deletions
|
@ -590,8 +590,10 @@ class Commands:
|
||||||
|
|
||||||
def completions_drop(self):
|
def completions_drop(self):
|
||||||
files = self.coder.get_inchat_relative_files()
|
files = self.coder.get_inchat_relative_files()
|
||||||
files = [self.quote_fname(fn) for fn in files]
|
read_only_files = [self.coder.get_rel_fname(fn) for fn in self.coder.abs_read_only_fnames]
|
||||||
return files
|
all_files = files + read_only_files
|
||||||
|
all_files = [self.quote_fname(fn) for fn in all_files]
|
||||||
|
return all_files
|
||||||
|
|
||||||
def cmd_drop(self, args=""):
|
def cmd_drop(self, args=""):
|
||||||
"Remove files from the chat session to free up context space"
|
"Remove files from the chat session to free up context space"
|
||||||
|
@ -599,6 +601,8 @@ class Commands:
|
||||||
if not args.strip():
|
if not args.strip():
|
||||||
self.io.tool_output("Dropping all files from the chat session.")
|
self.io.tool_output("Dropping all files from the chat session.")
|
||||||
self.coder.abs_fnames = set()
|
self.coder.abs_fnames = set()
|
||||||
|
self.coder.abs_read_only_fnames = set()
|
||||||
|
return
|
||||||
|
|
||||||
filenames = parse_quoted_filenames(args)
|
filenames = parse_quoted_filenames(args)
|
||||||
for word in filenames:
|
for word in filenames:
|
||||||
|
@ -612,6 +616,9 @@ class Commands:
|
||||||
if abs_fname in self.coder.abs_fnames:
|
if abs_fname in self.coder.abs_fnames:
|
||||||
self.coder.abs_fnames.remove(abs_fname)
|
self.coder.abs_fnames.remove(abs_fname)
|
||||||
self.io.tool_output(f"Removed {matched_file} from the chat")
|
self.io.tool_output(f"Removed {matched_file} from the chat")
|
||||||
|
elif abs_fname in self.coder.abs_read_only_fnames:
|
||||||
|
self.coder.abs_read_only_fnames.remove(abs_fname)
|
||||||
|
self.io.tool_output(f"Removed read-only file {matched_file} from the chat")
|
||||||
|
|
||||||
def cmd_git(self, args):
|
def cmd_git(self, args):
|
||||||
"Run a git command"
|
"Run a git command"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue