mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
![]() # Context: USER: have `prompt_toolkit` highlight the user input with a markdown lexer ASSISTANT: To highlight the user input with a markdown lexer, we need to modify the `aider/io.py` file. We will import the `MarkdownLexer` from `pygments.lexers.markup` and use it as the lexer for the `PromptSession`. Here's the change you need to make: ```python aider/io.py <<<<<<< ORIGINAL from pygments.lexers import guess_lexer_for_filename ======= from pygments.lexers import guess_lexer_for_filename, MarkdownLexer >>>>>>> UPDATED ``` And update the `PromptSession` instantiation in the `get_input` method: ```python aider/io.py <<<<<<< ORIGINAL session_kwargs = { "message": show, "completer": completer_instance, "reserve_space_for_menu": 4, "complete_style": CompleteStyle.MULTI_COLUMN, "input": self.input, "output": self.output, } ======= session_kwargs = { "message": show, "completer": completer_instance, "reserve_space_for_menu": 4, "complete_style": CompleteStyle.MULTI_COLUMN, "input": self.input, "output": self.output, "lexer": MarkdownLexer(), } >>>>>>> UPDATED ``` These changes will import the `MarkdownLexer` and use it for the `PromptSession`, which will highlight the user input with markdown syntax. |
||
---|---|---|
.. | ||
__init__.py | ||
coder.py | ||
commands.py | ||
dump.py | ||
io.py | ||
main.py | ||
prompts.py | ||
repomap.py | ||
utils.py |