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.
This commit is contained in:
Paul Gauthier 2023-07-19 09:06:49 -03:00
parent 60e49ae40c
commit 7930cea227

View file

@ -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"