mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 12:21:50 +00:00
Merge pull request #2298 from zed-industries/fix-deadlock
Fix deadlock while initializing JSON language server
This commit is contained in:
commit
3464961aa4
1 changed files with 18 additions and 13 deletions
|
@ -567,22 +567,27 @@ impl LanguageRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn workspace_configuration(&self, cx: &mut MutableAppContext) -> Task<serde_json::Value> {
|
pub fn workspace_configuration(&self, cx: &mut MutableAppContext) -> Task<serde_json::Value> {
|
||||||
|
let lsp_adapters = {
|
||||||
let state = self.state.read();
|
let state = self.state.read();
|
||||||
|
state
|
||||||
|
.available_languages
|
||||||
|
.iter()
|
||||||
|
.filter_map(|l| l.lsp_adapter.clone())
|
||||||
|
.chain(
|
||||||
|
state
|
||||||
|
.languages
|
||||||
|
.iter()
|
||||||
|
.filter_map(|l| l.adapter.as_ref().map(|a| a.adapter.clone())),
|
||||||
|
)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
};
|
||||||
|
|
||||||
let mut language_configs = Vec::new();
|
let mut language_configs = Vec::new();
|
||||||
for language in &state.available_languages {
|
for adapter in &lsp_adapters {
|
||||||
if let Some(adapter) = language.lsp_adapter.as_ref() {
|
|
||||||
if let Some(language_config) = adapter.workspace_configuration(cx) {
|
if let Some(language_config) = adapter.workspace_configuration(cx) {
|
||||||
language_configs.push(language_config);
|
language_configs.push(language_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for language in &state.languages {
|
|
||||||
if let Some(adapter) = language.lsp_adapter() {
|
|
||||||
if let Some(language_config) = adapter.workspace_configuration(cx) {
|
|
||||||
language_configs.push(language_config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cx.background().spawn(async move {
|
cx.background().spawn(async move {
|
||||||
let mut config = serde_json::json!({});
|
let mut config = serde_json::json!({});
|
||||||
|
|
Loading…
Reference in a new issue