lsp: Check for existing snapshots before sending off a didOpen notification (#25409)

Closes #ISSUE

Release Notes:

- Fixed Zed sending out didOpen notification to a language server when
opening documents.
This commit is contained in:
Piotr Osiewicz 2025-02-23 01:17:46 +01:00 committed by GitHub
parent 4067ae4b37
commit 918cba4cce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1921,17 +1921,20 @@ impl LocalLspStore {
version: 0,
snapshot: initial_snapshot.clone(),
};
self.buffer_snapshots
let previous_snapshots = self
.buffer_snapshots
.entry(buffer_id)
.or_default()
.insert(server.server_id(), vec![snapshot]);
server.register_buffer(
uri.clone(),
adapter.language_id(&language.name()),
0,
initial_snapshot.text(),
);
if previous_snapshots.is_none() {
server.register_buffer(
uri.clone(),
adapter.language_id(&language.name()),
0,
initial_snapshot.text(),
);
}
}
}
}