mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 02:34:59 +00:00
Merge branch 'main' into watch
This commit is contained in:
commit
b57ad6929c
30 changed files with 584 additions and 89 deletions
38
aider/io.py
38
aider/io.py
|
@ -4,6 +4,7 @@ import threading
|
|||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from io import StringIO
|
||||
from pathlib import Path
|
||||
|
||||
from prompt_toolkit.completion import Completer, Completion, ThreadedCompleter
|
||||
|
@ -16,6 +17,7 @@ from prompt_toolkit.shortcuts import CompleteStyle, PromptSession
|
|||
from prompt_toolkit.styles import Style
|
||||
from pygments.lexers import MarkdownLexer, guess_lexer_for_filename
|
||||
from pygments.token import Token
|
||||
from rich.columns import Columns
|
||||
from rich.console import Console
|
||||
from rich.markdown import Markdown
|
||||
from rich.style import Style as RichStyle
|
||||
|
@ -748,17 +750,35 @@ class InputOutput:
|
|||
self.chat_history_file = None # Disable further attempts to write
|
||||
|
||||
def format_files_for_input(self, rel_fnames, rel_read_only_fnames):
|
||||
read_only_files = []
|
||||
for full_path in sorted(rel_read_only_fnames or []):
|
||||
read_only_files.append(f"{full_path} (read only)")
|
||||
if not self.pretty:
|
||||
read_only_files = []
|
||||
for full_path in sorted(rel_read_only_fnames or []):
|
||||
read_only_files.append(f"{full_path} (read only)")
|
||||
|
||||
editable_files = []
|
||||
for full_path in sorted(rel_fnames):
|
||||
if full_path in rel_read_only_fnames:
|
||||
continue
|
||||
editable_files.append(f"{full_path}")
|
||||
editable_files = []
|
||||
for full_path in sorted(rel_fnames):
|
||||
if full_path in rel_read_only_fnames:
|
||||
continue
|
||||
editable_files.append(f"{full_path}")
|
||||
|
||||
return "\n".join(read_only_files + editable_files) + "\n"
|
||||
return "\n".join(read_only_files + editable_files) + "\n"
|
||||
|
||||
output = StringIO()
|
||||
console = Console(file=output, force_terminal=False)
|
||||
|
||||
read_only_files = sorted(rel_read_only_fnames or [])
|
||||
editable_files = [f for f in sorted(rel_fnames) if f not in rel_read_only_fnames]
|
||||
|
||||
if read_only_files:
|
||||
console.print("Read only files:", style="bold")
|
||||
console.print(Columns(read_only_files))
|
||||
if editable_files:
|
||||
if read_only_files:
|
||||
console.print()
|
||||
console.print("Editable files:", style="bold")
|
||||
console.print(Columns(editable_files))
|
||||
|
||||
return output.getvalue()
|
||||
|
||||
|
||||
def get_rel_fname(fname, root):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue