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, version: 0,
snapshot: initial_snapshot.clone(), snapshot: initial_snapshot.clone(),
}; };
self.buffer_snapshots let previous_snapshots = self
.buffer_snapshots
.entry(buffer_id) .entry(buffer_id)
.or_default() .or_default()
.insert(server.server_id(), vec![snapshot]); .insert(server.server_id(), vec![snapshot]);
server.register_buffer( if previous_snapshots.is_none() {
uri.clone(), server.register_buffer(
adapter.language_id(&language.name()), uri.clone(),
0, adapter.language_id(&language.name()),
initial_snapshot.text(), 0,
); initial_snapshot.text(),
);
}
} }
} }
} }