-
-
Notifications
You must be signed in to change notification settings - Fork 28
feat(server): auto-find port on Windows with async #65
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the server port detection mechanism by adding asynchronous operations and automatic port finding capabilities. The changes eliminate UI lag by replacing synchronous io.popen calls with vim.system, and introduce automatic free port detection when no opencode server is found.
Key changes:
- Converted all system command executions from synchronous to asynchronous using
vim.system - Added automatic free port detection in the range 4096-5096 when no server is found
- Implemented Windows support with PowerShell commands (though CWD checking is skipped on Windows)
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lua/opencode/config.lua | Updated on_opencode_not_found callback to accept a port parameter and append it to terminal command |
| lua/opencode/cli/server.lua | Replaced synchronous exec with async exec_async, added Windows-specific server finding logic, implemented free port detection, and converted all port finding operations to async callbacks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b2b6bc4 to
104e9f0
Compare
|
I have fix all the copilot suggest |
|
Thanks @erroris3 ! I can check this out later today I think.
I wonder if we should add a special option to |
|
It nice to have but this PR is already done that automatically |
|
I found out that test_port need to be in schedule. It should be fixed now |
BUT i giveup on finding the process cwd on windows so skip the check for that. Checking the parent should be enough (?).