Skip to content

Commit

Permalink
aider: Disable pretty output and inform the user if a VSCode terminal…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
paul-gauthier committed Jul 19, 2023
1 parent 60e49ae commit 7930cea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7930cea

Please sign in to comment.