mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-05 20:25:01 +00:00
refactor: simplify URL pattern matching and cleanup commented code
This commit is contained in:
parent
85ad2826da
commit
94c5ff2fd2
1 changed files with 6 additions and 7 deletions
|
@ -793,12 +793,11 @@ class Coder:
|
||||||
def check_and_open_urls(self, text: str) -> List[str]:
|
def check_and_open_urls(self, text: str) -> List[str]:
|
||||||
"""Check text for URLs and offer to open them in a browser."""
|
"""Check text for URLs and offer to open them in a browser."""
|
||||||
|
|
||||||
url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*?)([.']*$|[.',\s])")
|
url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*)")
|
||||||
dump(url_pattern)
|
|
||||||
# ai strip trailing . or ' from the url!
|
|
||||||
|
|
||||||
urls = list(set(url_pattern.findall(text))) # Use set to remove duplicates
|
urls = list(set(url_pattern.findall(text))) # Use set to remove duplicates
|
||||||
for url in urls:
|
for url in urls:
|
||||||
|
dump(url)
|
||||||
|
#ai strip all trailing .', from url!
|
||||||
if self.io.confirm_ask("Open URL for more info about this error?", subject=url):
|
if self.io.confirm_ask("Open URL for more info about this error?", subject=url):
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
return urls
|
return urls
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue