mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
feat: Implement partial prefix matching for /read-only command in completions_raw_read_only method
This commit is contained in:
parent
369310a7c3
commit
6287bf37e5
1 changed files with 9 additions and 4 deletions
|
@ -584,12 +584,18 @@ class Commands:
|
||||||
|
|
||||||
# Get the text before the cursor and strip leading spaces
|
# Get the text before the cursor and strip leading spaces
|
||||||
text = document.text_before_cursor.lstrip()
|
text = document.text_before_cursor.lstrip()
|
||||||
dump(text)
|
|
||||||
|
|
||||||
# Identify the command and extract text after it
|
# Identify the command and extract text after it
|
||||||
command = "/read-only"
|
command = "/read-only"
|
||||||
if text.startswith(command):
|
if text.startswith("/"):
|
||||||
after_command = text[len(command) :].lstrip()
|
# Find the longest matching prefix of "/read-only"
|
||||||
|
for i in range(len(command), 0, -1):
|
||||||
|
if text.startswith(command[:i]):
|
||||||
|
after_command = text[i:].lstrip()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# If no prefix matches, return no completions
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
after_command = text
|
after_command = text
|
||||||
|
|
||||||
|
@ -599,7 +605,6 @@ class Commands:
|
||||||
path_completer = PathCompleter(
|
path_completer = PathCompleter(
|
||||||
only_directories=False,
|
only_directories=False,
|
||||||
expanduser=True,
|
expanduser=True,
|
||||||
#get_paths=[self.coder.root],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use the new document for completions
|
# Use the new document for completions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue