Do not query for LSP tasks buffers that do not belong to the position given (#28536)

Follow-up of https://github.com/zed-industries/zed/pull/28359

Release Notes:

- Fixed a panic when LSP tasks are queried in certain multi buffer
excerpts
This commit is contained in:
Kirill Bulatov 2025-04-10 14:37:21 -06:00 committed by GitHub
parent 4a356466b1
commit 804066a047
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,6 +85,10 @@ pub fn lsp_tasks(
.map(|(name, buffer_ids)| {
let buffers = buffer_ids
.iter()
.filter(|&&buffer_id| match for_position {
Some(for_position) => for_position.buffer_id == Some(buffer_id),
None => true,
})
.filter_map(|&buffer_id| project.read(cx).buffer_for_id(buffer_id, cx))
.collect::<Vec<_>>();
language_server_for_buffers(project.clone(), name.clone(), buffers, cx)