Only generate workspace/configuration for relevant adapter
This commit is contained in:
@@ -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> {
|
||||
|
||||
@@ -103,23 +103,24 @@ impl LspAdapter for TailwindLspAdapter {
|
||||
}))
|
||||
}
|
||||
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> Option<BoxFuture<'static, Value>> {
|
||||
Some(
|
||||
future::ready(json!({
|
||||
"tailwindCSS": {
|
||||
"emmetCompletions": true,
|
||||
}
|
||||
}))
|
||||
.boxed(),
|
||||
)
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
future::ready(json!({
|
||||
"tailwindCSS": {
|
||||
"emmetCompletions": true,
|
||||
}
|
||||
}))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
async fn language_ids(&self) -> HashMap<String, String> {
|
||||
HashMap::from([
|
||||
("HTML".to_string(), "html".to_string()),
|
||||
("CSS".to_string(), "css".to_string()),
|
||||
("JavaScript".to_string(), "javascript".to_string()),
|
||||
])
|
||||
HashMap::from_iter(
|
||||
[
|
||||
("HTML".to_string(), "html".to_string()),
|
||||
("CSS".to_string(), "css".to_string()),
|
||||
("JavaScript".to_string(), "javascript".to_string()),
|
||||
]
|
||||
.into_iter(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,18 +202,16 @@ impl EsLintLspAdapter {
|
||||
|
||||
#[async_trait]
|
||||
impl LspAdapter for EsLintLspAdapter {
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> Option<BoxFuture<'static, Value>> {
|
||||
Some(
|
||||
future::ready(json!({
|
||||
"": {
|
||||
"validate": "on",
|
||||
"rulesCustomizations": [],
|
||||
"run": "onType",
|
||||
"nodePath": null,
|
||||
}
|
||||
}))
|
||||
.boxed(),
|
||||
)
|
||||
fn workspace_configuration(&self, _: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
future::ready(json!({
|
||||
"": {
|
||||
"validate": "on",
|
||||
"rulesCustomizations": [],
|
||||
"run": "onType",
|
||||
"nodePath": null,
|
||||
}
|
||||
}))
|
||||
.boxed()
|
||||
}
|
||||
|
||||
async fn name(&self) -> LanguageServerName {
|
||||
|
||||
@@ -86,21 +86,20 @@ impl LspAdapter for YamlLspAdapter {
|
||||
) -> Option<LanguageServerBinary> {
|
||||
get_cached_server_binary(container_dir, &self.node).await
|
||||
}
|
||||
fn workspace_configuration(&self, cx: &mut AppContext) -> Option<BoxFuture<'static, Value>> {
|
||||
fn workspace_configuration(&self, cx: &mut AppContext) -> BoxFuture<'static, Value> {
|
||||
let tab_size = all_language_settings(None, cx)
|
||||
.language(Some("YAML"))
|
||||
.tab_size;
|
||||
Some(
|
||||
future::ready(serde_json::json!({
|
||||
"yaml": {
|
||||
"keyOrdering": false
|
||||
},
|
||||
"[yaml]": {
|
||||
"editor.tabSize": tab_size,
|
||||
}
|
||||
}))
|
||||
.boxed(),
|
||||
)
|
||||
|
||||
future::ready(serde_json::json!({
|
||||
"yaml": {
|
||||
"keyOrdering": false
|
||||
},
|
||||
"[yaml]": {
|
||||
"editor.tabSize": tab_size,
|
||||
}
|
||||
}))
|
||||
.boxed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user