-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(lsp): add restartServer operation #6233
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: dev
Are you sure you want to change the base?
Conversation
|
Is this something we should do automatically? We do have a file watcher... |
|
Tho I will say I do like the ability of the user to restart lsp servers too |
|
Automatic restart would be a nice QoL feature I for sure. I didn't want to make the changes too aggressive though since the LSP tool is still tagged experimental so I thought it best to keep it simple. I know pyright would benefit from automatic restarts when adding dependencies to a project. Rust might be more challenging as I think it goes out of sync over time but I've less experience with this one. Happy to to take a look though unless it's something you want to handle. |
|
Gotcha, hm do u think the best spot for this is for the agent? Ig it makes some sense... There are the 3 cases:
Trying to think which one is highest priority, because the agent invoked one seems like it could lead to the worst outcomes if the agent confuses itself but ur changes prolly wouldn't cause that |
|
Have you been using the experimental lsp tool? (or ig has ur agent?) |
|
I literally just ran into this so, interesting |
|
I've been using it a fair bit yeah, really nice addition! In the case of pyright it's a long standing issue that the LSP needs restarting on environment changes, there's no config options available to my knowledge. They (and pylance) have several open issues regarding it. Perhaps that needs addressing directly with them and we leave the ability open for the user/agent to trigger a restart? I'm trying to think what the dangers would be if the agent did get confused. Opus and Sonnet both seem leverage the restart feature well for what it's worth. |

Summary
Add
restartServeroperation to the LSP toolProblem
When installing new packages (e.g., adding
pyavtopyproject.toml), pyright doesn't pick up the changes automatically. It continues throwing diagnostic errors on every edit until opencode is restarted. Also affects rust-analyzer.Solution
Allow opencode to restart the LSP server by file extension without requiring a full opencode restart.
Related: #5899, #2156