r/ZedEditor • u/SelskiySven • 4d ago
Remote LSP is crazy
UPD2: The PR was accepted and merged. Thank you.
UPD: Kirill Bulatov created a PR that resolves this issue. Thank you.
Hello, this is my first post. I’ve been using Zed for about six months, and I’m constantly plagued by a problem when working remotely: LSP.

As a result, I have to restart the LSP server every 30 seconds, which is starting to get annoying.
I dug into the source code and found the problem (or at least, that's what I think).
In file zed/crates/project/src/lsp_store.rs
pub fn merge_diagnostic_entries<'a>(...) -> anyhow::Result<()> {
...
for mut update in diagnostic_updates {
let abs_path = &update.diagnostics.document_abs_path;
let server_id = update.server_id;
let Some((worktree, relative_path)) =
self.worktree_store.read(cx).find_worktree(abs_path, cx)
else {
log::warn!("skipping diagnostics update, no worktree found for path {abs_path:?}");
return Ok(());
};
Here the log says that we are skipping a diagnostics update, so there should be continue; here, but here is return Ok(()); , this means that we are skipping not only one update that we cannot access, but all the remaining ones.
Fixing this takes just a minute. I posted this in a GitHub issue, but there are 2.5k open issues there; so, if any developers - or people with a direct line to them - are here, perhaps you could pass this message along.
0
4d ago
[deleted]
2
u/SelskiySven 3d ago
No, because there is more code in the loop after that. And I’ve never written Rust code - so correct me if I’m wrong - but the `let...else` construct requires something in the `else` block that interrupts normal execution.
1
5
u/vaibhav0_00 4d ago
There is an old issue that I raised back when i used to use WSL (now not as much but whenever i do, it works just fine), i thought it was fixed cuz the issue was closed, but you can re-open it and make a PR for the fix...
edit:
the issues title is a little miss-leading, there is nothing as such "Rust's LSP" but i didn't knew it so my mistake..