mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
refactor: Pass placeholder to _generic_chat_command
instead of special-casing context
This commit is contained in:
parent
be87ff0193
commit
b2444b43a6
1 changed files with 10 additions and 18 deletions
|
@ -1148,9 +1148,9 @@ class Commands:
|
|||
|
||||
def cmd_context(self, args):
|
||||
"""Enter context mode to see surrounding code context. If no prompt provided, switches to context mode.""" # noqa
|
||||
return self._generic_chat_command(args, "context")
|
||||
return self._generic_chat_command(args, "context", placeholder=args.strip() or None)
|
||||
|
||||
def _generic_chat_command(self, args, edit_format):
|
||||
def _generic_chat_command(self, args, edit_format, placeholder=None):
|
||||
if not args.strip():
|
||||
# Switch to the corresponding chat mode if no args provided
|
||||
return self.cmd_chat_mode(edit_format)
|
||||
|
@ -1167,22 +1167,14 @@ class Commands:
|
|||
user_msg = args
|
||||
coder.run(user_msg)
|
||||
|
||||
# When using context command, set the placeholder to the args
|
||||
if edit_format == "context" and args.strip():
|
||||
raise SwitchCoder(
|
||||
edit_format=self.coder.edit_format,
|
||||
summarize_from_coder=False,
|
||||
from_coder=coder,
|
||||
show_announcements=False,
|
||||
placeholder=args,
|
||||
)
|
||||
else:
|
||||
raise SwitchCoder(
|
||||
edit_format=self.coder.edit_format,
|
||||
summarize_from_coder=False,
|
||||
from_coder=coder,
|
||||
show_announcements=False,
|
||||
)
|
||||
# Use the provided placeholder if any
|
||||
raise SwitchCoder(
|
||||
edit_format=self.coder.edit_format,
|
||||
summarize_from_coder=False,
|
||||
from_coder=coder,
|
||||
show_announcements=False,
|
||||
placeholder=placeholder,
|
||||
)
|
||||
|
||||
def get_help_md(self):
|
||||
"Show help about all commands in markdown"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue