MattFlower / vscode-aider-extension

74 stars 18 forks source link

The plugin currently doesn't work with Windows #3

Open MattFlower opened 9 months ago

MattFlower commented 9 months ago

Currently, the plugin doesn't work with windows.

MattFlower commented 9 months ago

I have some preliminary code that will fix with cmd.exe. I'll try to get this out tomorrow.

MattFlower commented 9 months ago

Update: I was able to get aider to execute in windows. Unfortunately, there appears to be a problem -- when I attempt to send "/add " or "/drop " to the terminal window, aider doesn't recognize the carriage return. If I go into the window and hit return, the command will be executed. This is a problem as you start to add or drop multiple files as the commands stack up and won't execute correctly even if I hit enter.

This only appears with aider -- sending commands to cmd.exe, wsl.exe, or powershell.exe all seemed to work fine. If been looking at the aider source code and io.py, but I have quite figured out what's wrong.

TL;DR: Windows is still busted. Sorry about that.

kokushkin commented 2 months ago

does it mean that the plugin isn't working on Windows at the moment? I mean, I can't even see the icon on the left panel where is other plugins. No errors either, just won't open.

vsEcho567 commented 1 week ago

any update?

vsEcho567 commented 1 week ago

@MattFlower Hey there, I think I've figured out the root of the problem. On Windows, the prompt toolkit used by aider is mistakenly treating command text along with the '\r' character as a 'paste action'. This is why it's not working like when you manually press Enter in the terminal. Here's a somewhat unrelated but potentially useful link: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/548

Because of a flaw in aider's code, it's not straightforward to fix this directly. One workaround is to send the command and the Enter key separately to the terminal within your plugin:

step1. Send: /add xxx step2. Wait for 50ms or more step3. Send: \r"