mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-27 15:55:00 +00:00
Merge branch 'main' of github.com:Aider-AI/aider
This commit is contained in:
commit
bcb01e8c1b
3 changed files with 30 additions and 2 deletions
|
@ -64,7 +64,7 @@ class FileWatcher:
|
|||
"""Watches source files for changes and AI comments"""
|
||||
|
||||
# Compiled regex pattern for AI comments
|
||||
ai_comment_pattern = re.compile(r"(?:#|//|--) *(ai\b.*|ai\b.*|.*\bai[?!]?) *$", re.IGNORECASE)
|
||||
ai_comment_pattern = re.compile(r"(?:#|//|--|;+) *(ai\b.*|ai\b.*|.*\bai[?!]?) *$", re.IGNORECASE)
|
||||
|
||||
def __init__(self, coder, gitignores=None, verbose=False, analytics=None, root=None):
|
||||
self.coder = coder
|
||||
|
@ -262,7 +262,7 @@ class FileWatcher:
|
|||
line_nums.append(i)
|
||||
comments.append(comment)
|
||||
comment = comment.lower()
|
||||
comment = comment.lstrip("/#-")
|
||||
comment = comment.lstrip("/#-;") # Added semicolon for Lisp comments
|
||||
comment = comment.strip()
|
||||
if comment.startswith("ai!") or comment.endswith("ai!"):
|
||||
has_action = "!"
|
||||
|
|
|
@ -155,3 +155,12 @@ def test_ai_comment_pattern():
|
|||
assert (
|
||||
question_js_has_bang == "?"
|
||||
), "Expected at least one bang (!) comment in watch_question.js fixture"
|
||||
|
||||
# Test Lisp fixture
|
||||
lisp_path = fixtures_dir / "watch.lisp"
|
||||
lisp_lines, lisp_comments, lisp_has_bang = watcher.get_ai_comments(str(lisp_path))
|
||||
lisp_expected = 7
|
||||
assert (
|
||||
len(lisp_lines) == lisp_expected
|
||||
), f"Expected {lisp_expected} AI comments in Lisp fixture, found {len(lisp_lines)}"
|
||||
assert lisp_has_bang == "!", "Expected at least one bang (!) comment in Lisp fixture"
|
||||
|
|
19
tests/fixtures/watch.lisp
vendored
Normal file
19
tests/fixtures/watch.lisp
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
(defun hello-world ()
|
||||
;; ai this is a simple hello world function
|
||||
(format t "Hello, World!"))
|
||||
|
||||
(defun add (a b)
|
||||
; ai! fix this function to handle nil values
|
||||
(+ a b))
|
||||
|
||||
(defun multiply (a b)
|
||||
;;; ai? why is this function not working with large numbers?
|
||||
(* a b))
|
||||
|
||||
; ai this is a single semicolon comment
|
||||
|
||||
;; ai this is a double semicolon comment
|
||||
|
||||
;;; ai this is a triple semicolon comment
|
||||
|
||||
;;;; ai! this is a quadruple semicolon comment
|
Loading…
Add table
Add a link
Reference in a new issue