mirror of
https://github.com/Aider-AI/aider
synced 2026-04-25 17:15:07 +02:00
handle and test for trailing whitespace after ai
This commit is contained in:
@@ -72,7 +72,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):
|
||||
self.coder = coder
|
||||
|
||||
@@ -37,7 +37,7 @@ def test_ai_comment_pattern():
|
||||
# Test JavaScript fixture
|
||||
js_path = fixtures_dir / "watch.js"
|
||||
js_lines, js_comments, js_has_bang = watcher.get_ai_comments(str(js_path))
|
||||
js_expected = 14
|
||||
js_expected = 16
|
||||
assert (
|
||||
len(js_lines) == js_expected
|
||||
), f"Expected {js_expected} AI comments in JavaScript fixture, found {len(js_lines)}"
|
||||
|
||||
3
tests/fixtures/watch.js
vendored
3
tests/fixtures/watch.js
vendored
@@ -33,3 +33,6 @@ class Example {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// trailing whitespace ai
|
||||
// trailing whitespace ai!
|
||||
// 15-16
|
||||
|
||||
Reference in New Issue
Block a user