Only generate workspace/configuration for relevant adapter

This commit is contained in:
Julia 2023-08-22 23:36:04 -04:00
parent 814896de3f
commit affb73d651
6 changed files with 95 additions and 134 deletions

View file

@ -102,7 +102,7 @@ impl LspAdapter for JsonLspAdapter {
fn workspace_configuration(
&self,
cx: &mut AppContext,
) -> Option<BoxFuture<'static, serde_json::Value>> {
) -> BoxFuture<'static, serde_json::Value> {
let action_names = cx.all_action_names().collect::<Vec<_>>();
let staff_mode = cx.default_global::<StaffMode>().0;
let language_names = &self.languages.language_names();
@ -113,29 +113,28 @@ impl LspAdapter for JsonLspAdapter {
},
cx,
);
Some(
future::ready(serde_json::json!({
"json": {
"format": {
"enable": true,
future::ready(serde_json::json!({
"json": {
"format": {
"enable": true,
},
"schemas": [
{
"fileMatch": [
schema_file_match(&paths::SETTINGS),
&*paths::LOCAL_SETTINGS_RELATIVE_PATH,
],
"schema": settings_schema,
},
"schemas": [
{
"fileMatch": [
schema_file_match(&paths::SETTINGS),
&*paths::LOCAL_SETTINGS_RELATIVE_PATH,
],
"schema": settings_schema,
},
{
"fileMatch": [schema_file_match(&paths::KEYMAP)],
"schema": KeymapFile::generate_json_schema(&action_names),
}
]
}
}))
.boxed(),
)
{
"fileMatch": [schema_file_match(&paths::KEYMAP)],
"schema": KeymapFile::generate_json_schema(&action_names),
}
]
}
}))
.boxed()
}
async fn language_ids(&self) -> HashMap<String, String> {