mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35:00 +00:00
Fix issue with quoting
/commands
This commit is contained in:
parent
579fc39d61
commit
b6f682151d
1 changed files with 8 additions and 4 deletions
12
aider/io.py
12
aider/io.py
|
@ -55,6 +55,7 @@ class AutoCompleter(Completer):
|
||||||
if text[0] == "/":
|
if text[0] == "/":
|
||||||
if len(words) == 1 and not text[-1].isspace():
|
if len(words) == 1 and not text[-1].isspace():
|
||||||
candidates = self.commands.get_commands()
|
candidates = self.commands.get_commands()
|
||||||
|
candidates = [(cmd, cmd) for cmd in candidates]
|
||||||
else:
|
else:
|
||||||
for completion in self.commands.get_command_completions(words[0][1:], words[-1]):
|
for completion in self.commands.get_command_completions(words[0][1:], words[-1]):
|
||||||
yield completion
|
yield completion
|
||||||
|
@ -62,18 +63,21 @@ class AutoCompleter(Completer):
|
||||||
else:
|
else:
|
||||||
candidates = self.words
|
candidates = self.words
|
||||||
candidates.update(set(self.fname_to_rel_fnames))
|
candidates.update(set(self.fname_to_rel_fnames))
|
||||||
|
candidates = [(word, f"`{word}`") for word in candidates]
|
||||||
|
|
||||||
last_word = words[-1]
|
last_word = words[-1]
|
||||||
for word in candidates:
|
for word_match, word_insert in candidates:
|
||||||
if word.lower().startswith(last_word.lower()):
|
if word_match.lower().startswith(last_word.lower()):
|
||||||
rel_fnames = self.fname_to_rel_fnames.get(word, [])
|
rel_fnames = self.fname_to_rel_fnames.get(word_match, [])
|
||||||
if rel_fnames:
|
if rel_fnames:
|
||||||
for rel_fname in rel_fnames:
|
for rel_fname in rel_fnames:
|
||||||
yield Completion(
|
yield Completion(
|
||||||
f"`{rel_fname}`", start_position=-len(last_word), display=rel_fname
|
f"`{rel_fname}`", start_position=-len(last_word), display=rel_fname
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
yield Completion(f"`{word}`", start_position=-len(last_word), display=word)
|
yield Completion(
|
||||||
|
word_insert, start_position=-len(last_word), display=word_match
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class InputOutput:
|
class InputOutput:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue