mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
Add program argument for syntax highlighting theme.
The source code output in the chat will be colored in the given color scheme. Syntax highlighting is powered by pygments, which supports many styles out of the box. For example: - default (the default) - dracula - emacs - github-dark - monokai - vim - solarized-dark - solarized-light See https://pygments.org/styles/
This commit is contained in:
parent
bc6e958d7e
commit
b80c83c6cb
2 changed files with 10 additions and 2 deletions
|
@ -111,6 +111,7 @@ class Coder:
|
|||
map_tokens=1024,
|
||||
verbose=False,
|
||||
assistant_output_color="blue",
|
||||
code_theme="default",
|
||||
stream=True,
|
||||
use_git=True,
|
||||
):
|
||||
|
@ -135,6 +136,7 @@ class Coder:
|
|||
self.auto_commits = auto_commits
|
||||
self.dirty_commits = dirty_commits
|
||||
self.assistant_output_color = assistant_output_color
|
||||
self.code_theme = code_theme
|
||||
|
||||
self.dry_run = dry_run
|
||||
self.pretty = pretty
|
||||
|
@ -679,7 +681,7 @@ class Coder:
|
|||
|
||||
show_resp = self.render_incremental_response(True)
|
||||
if self.pretty:
|
||||
show_resp = Markdown(show_resp, style=self.assistant_output_color, code_theme="default")
|
||||
show_resp = Markdown(show_resp, style=self.assistant_output_color, code_theme=self.code_theme)
|
||||
else:
|
||||
show_resp = Text(show_resp or "<no response>")
|
||||
|
||||
|
@ -735,7 +737,7 @@ class Coder:
|
|||
if not show_resp:
|
||||
return
|
||||
|
||||
md = Markdown(show_resp, style=self.assistant_output_color, code_theme="default")
|
||||
md = Markdown(show_resp, style=self.assistant_output_color, code_theme=self.code_theme)
|
||||
live.update(md)
|
||||
|
||||
def render_incremental_response(self, final):
|
||||
|
|
|
@ -145,6 +145,11 @@ def main(args=None, input=None, output=None):
|
|||
default="blue",
|
||||
help="Set the color for assistant output (default: blue)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--code-theme",
|
||||
default="default",
|
||||
help="Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--apply",
|
||||
metavar="FILE",
|
||||
|
@ -272,6 +277,7 @@ def main(args=None, input=None, output=None):
|
|||
map_tokens=args.map_tokens,
|
||||
verbose=args.verbose,
|
||||
assistant_output_color=args.assistant_output_color,
|
||||
code_theme=args.code_theme,
|
||||
stream=args.stream,
|
||||
use_git=args.git,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue