Fix panic in request_multiple_lsp_locally (#22806)

Release Notes:

- Fix a panic after disconnecting from a remote project
This commit is contained in:
Conrad Irwin 2025-01-07 20:34:24 -07:00 committed by GitHub
parent 222b04548d
commit 0b361e5b7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5592,13 +5592,13 @@ impl LspStore {
<R::LspRequest as lsp::request::Request>::Result: Send, <R::LspRequest as lsp::request::Request>::Result: Send,
<R::LspRequest as lsp::request::Request>::Params: Send, <R::LspRequest as lsp::request::Request>::Params: Send,
{ {
debug_assert!(self.upstream_client().is_none()); let Some(local) = self.as_local() else {
return Task::ready(Vec::new());
};
let snapshot = buffer.read(cx).snapshot(); let snapshot = buffer.read(cx).snapshot();
let scope = position.and_then(|position| snapshot.language_scope_at(position)); let scope = position.and_then(|position| snapshot.language_scope_at(position));
let server_ids = self let server_ids = local
.as_local()
.unwrap()
.language_servers_for_buffer(buffer.read(cx), cx) .language_servers_for_buffer(buffer.read(cx), cx)
.filter(|(adapter, _)| { .filter(|(adapter, _)| {
scope scope