Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aider companion support #2067

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

wladimiiir
Copy link

This PR resolves #2066

  • introduction of Companion class for communication between aider and companion
  • added --enable-companion argument to enable the use of companion
  • added commands /companion start//companion stop to enable or disable companion communication
  • fetching /open-files from companion Rest API and adding them automatically to the context

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2024

CLA assistant check
All committers have signed the CLA.

@wladimiiir
Copy link
Author

I am aware of missing tests. As this is proposal of the feature and the implementation might probably change, I will add the tests when agreed on final solution. Thank you.

@jerzydziewierz
Copy link

jerzydziewierz commented Oct 16, 2024

+1
seems like a workable alternative to my PR: #1620

clearly this is a feature needed enough that more than one person bothered to implement it

@jerzydziewierz
Copy link

𝄞 aider --enable-companion
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Uncaught UnboundLocalError in main.py line 679

Aider version: 0.59.2.dev34+gdba76307
Python version: 3.10.14
Platform: Linux-6.8.0-45-generic-x86_64-with-glibc2.35
Python implementation: CPython
Virtual environment: No
OS: Linux 6.8.0-45-generic (64bit)
Git version: git version 2.34.1

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
  File "main.py", line 679, in main
    companion=companion,
UnboundLocalError: local variable 'companion' referenced before assignment

Please consider reporting this bug to help improve aider!
Open a GitHub Issue pre-filled with the above error in your browser? (Y/n) n
Traceback (most recent call last):
File "/home/mib07150/git/zfs/conda-envs/py310qlm/bin/aider", line 8, in
sys.exit(main())
File "/home/mib07150/git/zfs/git/private/2024-agents/aider_edits_to_PR/aider_fork/aider/main.py", line 679, in main
companion=companion,
UnboundLocalError: local variable 'companion' referenced before assignment

@jerzydziewierz
Copy link

jerzydziewierz commented Oct 16, 2024

Bug report: JetBrains Plugin:

I normally work with 2X IDEs (CLion and Pycharm) and have them open simultaneously,
and the settings are synced meaning if I install the plugin in one IDE, the second one installs it too,

and I get:

Failed to start REST API server

java.net.BindException: Address already in use
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:555)

please ping me if you need someone to test any improvements to your code,

I like the general idea

for now I think I will be using my save/load extension from #1620 as that works well for me

@wladimiiir wladimiiir force-pushed the aider-companion branch 2 times, most recently from 5ef2fe0 to 3272da2 Compare October 16, 2024 20:30
@wladimiiir
Copy link
Author

@jerzydziewierz
Thanks for the testing and input, I have fixed the issues in aider.

As for your use case of having two instances of JB products, there is currently an issue in Aider Companion plugin where it's initialized on the project level instead of application level, making it run multiple times per opened window - the pending fix is awaiting approval in Plugin Marketplace. But this does not touch your issue anyways as you have 2 different applications. My idea is to be able to set different ports in the plugin settings UI, which you could set up differently for CLion/Pycharm and then when running aider instances you could set the base URL using --companion-base-url argument. I will let you know when I get to it, but feel free to implement the UI for that yourself, if you are interested in the plugin repo.

Thanks.

@IDontHaveBrain
Copy link

Thanks for the great plugin.

How about setting up a rest server in Aider itself and receiving a file list?
It seems like it would be easier to integrate with vscode or other extensions.

@wladimiiir
Copy link
Author

@IDontHaveBrain
That's also a possibility, thanks for the suggestion. Another one is to use WebSocket connection for both-way communication (for the additional future features that would require that). This is definitely one of the points for the discussion here, what's the best way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Support for IDE Companion
4 participants