Commit graph

8043 commits

Author SHA1 Message Date
Paul Gauthier (aider)
bff1b3de9c refactor: centralize completion menu styles in _get_style method to reduce code duplication 2024-09-27 19:43:12 -07:00
Paul Gauthier (aider)
cf46d9cdd0 style: run linter and format completion menu style definitions 2024-09-27 19:41:56 -07:00
Paul Gauthier (aider)
2c084d65d9 refactor: centralize style creation logic by introducing _get_style method in InputOutput class 2024-09-27 19:41:51 -07:00
Paul Gauthier (aider)
41d5b284e3 fix: resolve syntax errors in commands.py and improve file handling logic 2024-09-27 19:31:43 -07:00
Paul Gauthier (aider)
45d94b1c7c fix: handle file status correctly in /add and _add_read_only_file commands 2024-09-27 19:30:20 -07:00
Paul Gauthier (aider)
2509f0704f style: Fix formatting in commands.py 2024-09-27 17:10:10 -07:00
Paul Gauthier (aider)
1f56118c99 feat: Simplify completions_raw_read_only method 2024-09-27 17:10:05 -07:00
Paul Gauthier
38d03bca09 fix: Rename _old_completions_add to completions_add 2024-09-27 17:10:04 -07:00
Paul Gauthier (aider)
731f312731 fix: remove unused import of 'shlex' 2024-09-27 17:06:32 -07:00
Paul Gauthier
635a800032 fix: Quote file names with spaces in completions 2024-09-27 17:06:27 -07:00
Paul Gauthier (aider)
87da3a7132 fix: adjust start_position for quoted filename completions in completions_raw_read_only method 2024-09-27 16:53:15 -07:00
Paul Gauthier
eef97e4938 fix: remove redundant import of shlex in commands.py 2024-09-27 16:53:14 -07:00
Paul Gauthier (aider)
36bc8f90db fix: properly quote filenames with spaces and special characters using shlex.quote() 2024-09-27 16:52:06 -07:00
Paul Gauthier (aider)
c4e766a4c4 style: run linter and reorder import statements in commands.py 2024-09-27 16:51:01 -07:00
Paul Gauthier (aider)
8bb9bbef19 feat: modify PathCompleter to quote filenames with spaces in completions 2024-09-27 16:50:57 -07:00
Paul Gauthier
2a79723336 refactor: rename completions_add method to _old_completions_add for clarity 2024-09-27 16:50:57 -07:00
Paul Gauthier
542afbeb74 fix: Use self.coder.root instead of self.root in get_paths function 2024-09-27 16:48:55 -07:00
Paul Gauthier (aider)
9644546a65 feat: add get_paths function to PathCompleter for starting from self.root if not None 2024-09-27 16:47:47 -07:00
Paul Gauthier
79e0b80f34 Merge branch 'main' into path-completer 2024-09-27 16:46:24 -07:00
Paul Gauthier
7e4e6782d1 fix: set max_tokens to 1 for cache warming 2024-09-27 16:46:03 -07:00
Paul Gauthier (aider)
aab01086a2 style: fix formatting in base_coder.py 2024-09-27 16:43:24 -07:00
Paul Gauthier (aider)
f7818c6994 feat: Use **kwargs for extra_params in warm_cache_worker 2024-09-27 16:43:18 -07:00
Paul Gauthier
22c60cad1a refactor: Replace extra_params with extra_headers in cache warming request 2024-09-27 16:43:17 -07:00
Paul Gauthier
237ee1c5a1 Merge branch 'main' into path-completer 2024-09-27 16:40:53 -07:00
Paul Gauthier (aider)
87e4010b8b style: Run linter 2024-09-27 16:39:42 -07:00
Paul Gauthier (aider)
7830dadccf fix: Remove unused imports in aider/commands.py 2024-09-27 16:39:37 -07:00
Paul Gauthier (aider)
6287bf37e5 feat: Implement partial prefix matching for /read-only command in completions_raw_read_only method 2024-09-27 16:39:26 -07:00
Paul Gauthier
369310a7c3 fix: Remove commented-out code in PathCompleter configuration 2024-09-27 16:39:25 -07:00
Paul Gauthier (aider)
7e1497e114 style: Run linter and fix code formatting issues in commands.py 2024-09-27 16:35:27 -07:00
Paul Gauthier (aider)
57257b7c15 fix: correct indentation error in completions_raw_read_only method in aider/commands.py 2024-09-27 16:35:22 -07:00
Paul Gauthier (aider)
68c4817c14 fix: adjust completions_raw_read_only to process only file path input for correct path completions 2024-09-27 16:34:55 -07:00
Paul Gauthier (aider)
c35a41466b fix: correct completions_raw_read_only method to yield all path completions without unnecessary filtering 2024-09-27 16:25:39 -07:00
Paul Gauthier
bb740f3004 refactor: Replace extra_headers with extra_params in cache warming request 2024-09-27 16:22:17 -07:00
Paul Gauthier
c745d0dc38 wip 2024-09-27 16:21:18 -07:00
Paul Gauthier (aider)
9c5ef0b41a style: run linter 2024-09-27 16:17:41 -07:00
Paul Gauthier (aider)
2d3605156e feat: Implement file path completion for read-only command 2024-09-27 16:17:37 -07:00
Paul Gauthier
8e276939a7 feat: Implement completions_raw_read_only method
diff --git a/aider/commands.py b/aider/commands.py
index 80dd81dd..d4d4d4d1 100644
--- a/aider/commands.py
+++ b/aider/commands.py
@@ -580,7 +580,31 @@ class Commands:
         return fname

     def completions_raw_read_only(self, document, complete_event):
-        pass
+        # Extract the part of the input after the command
+        text = document.text[len("/read-only") :].lstrip()
+
+        # Create a PathCompleter
+        path_completer = PathCompleter(
+            only_directories=False,
+            expanduser=True,
+            get_paths=lambda: [self.coder.root],
+        )
+
+        # Create a new Document object with the modified text
+        new_document = Document(text, cursor_position=len(text))
+
+        # Get completions from the PathCompleter
+        completions = path_completer.get_completions(new_document, complete_event)
+
+        # Yield the completions
+        for completion in completions:
+            # Adjust the start position to account for the command
+            yield Completion(
+                completion.text,
+                start_position=completion.start_position - len(document.text) + len(text),
+                display=completion.display,
+                display_meta=completion.display_meta,
+            )

     def completions_add(self):
         files = set(self.coder.get_all_relative_files())
2024-09-27 16:17:35 -07:00
Paul Gauthier (aider)
c2afdcfdb9 fix: Create new Document object for path completion in completions_raw_read_only 2024-09-27 16:10:16 -07:00
Paul Gauthier
8e02cadfbc fix: Ensure command starts with slash before retrieving raw completions 2024-09-27 16:10:14 -07:00
Paul Gauthier (aider)
0a77b6cfac feat: Add Completion import to aider/commands.py 2024-09-27 16:07:35 -07:00
Paul Gauthier (aider)
f8390a889b style: Ran the linter 2024-09-27 16:06:44 -07:00
Paul Gauthier (aider)
b930a1db40 feat: Add raw completer for cmd_read_only command 2024-09-27 16:06:39 -07:00
Paul Gauthier (aider)
ee4de6bd1c feat: Add get_raw_completions method to Commands class 2024-09-27 16:05:40 -07:00
Paul Gauthier (aider)
6c2c3942bf feat: Add document and complete_event parameters to get_command_completions 2024-09-27 16:04:17 -07:00
Paul Gauthier
3ec0861727 fix: Add support for raw completers in AutoCompleter 2024-09-27 16:04:16 -07:00
Paul Gauthier (aider)
37b512e4fc feat: Update get_command_completions and get_completions methods 2024-09-27 15:59:56 -07:00
Paul Gauthier
01437fa58c copy 2024-09-27 14:29:35 -07:00
Paul Gauthier
927d03cc37 copy 2024-09-27 14:28:53 -07:00
Paul Gauthier (aider)
114fb2a889 style: Improve code formatting and readability 2024-09-27 14:26:56 -07:00
Paul Gauthier (aider)
f95c4626cf fix: Handle clipboard copy errors in cmd_copy 2024-09-27 14:26:50 -07:00