From 7930cea227616b4dda40dbae7328b9561a4cbe19 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 19 Jul 2023 09:06:49 -0300 Subject: [PATCH] aider: Disable pretty output and inform the user if a VSCode terminal has been detected. # Aider chat conversation: USER: if VSCODE_GIT_IPC_HANDLE is set in the environment, turn off pretty and tell the user a VSCode terminal has been detected so pretty output has been disabled ASSISTANT: To implement this change, we need to modify the `main` function in the `aider/main.py` file. We will check if the `VSCODE_GIT_IPC_HANDLE` environment variable is set and if so, disable pretty output and inform the user. Here is the proposed change: ```python aider/main.py <<<<<<< ORIGINAL args = parser.parse_args(args) if args.dark_mode: args.user_input_color = "#32FF32" args.tool_error_color = "#FF3333" args.assistant_output_color = "#00FFFF" args.code_theme = "monokai" if args.light_mode: args.user_input_color = "green" args.tool_error_color = "red" args.assistant_output_color = "blue" args.code_theme = "default" ======= args = parser.parse_args(args) if 'VSCODE_GIT_IPC_HANDLE' in os.environ: args.pretty = False print("VSCode terminal detected, pretty output has been disabled.") if args.dark_mode: args.user_input_color = "#32FF32" args.tool_error_color = "#FF3333" args.assistant_output_color = "#00FFFF" args.code_theme = "monokai" if args.light_mode: args.user_input_color = "green" args.tool_error_color = "red" args.assistant_output_color = "blue" args.code_theme = "default" >>>>>>> UPDATED ``` This change checks for the `VSCODE_GIT_IPC_HANDLE` environment variable right after parsing the arguments. If it's present, it sets `args.pretty` to `False` and prints a message to the user. --- aider/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aider/main.py b/aider/main.py index 2162ec8a2..023dbd52b 100644 --- a/aider/main.py +++ b/aider/main.py @@ -342,6 +342,10 @@ def main(args=None, input=None, output=None): args = parser.parse_args(args) + if 'VSCODE_GIT_IPC_HANDLE' in os.environ: + args.pretty = False + print("VSCode terminal detected, pretty output has been disabled.") + if args.dark_mode: args.user_input_color = "#32FF32" args.tool_error_color = "#FF3333"