language: Fix no diagnostics are shown for CSS (#35663)
Closes #30499 `vscode-css-language-server` throws a null reference error if no workspace configuration is provided from the client. Release Notes: - Fixed issue where no diagnostics were shown for CSS, LESS, and SCSS.
This commit is contained in:
parent
6b77654f66
commit
cf23f93917
1 changed files with 33 additions and 2 deletions
|
@ -5,7 +5,7 @@ use gpui::AsyncApp;
|
|||
use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate};
|
||||
use lsp::{LanguageServerBinary, LanguageServerName};
|
||||
use node_runtime::NodeRuntime;
|
||||
use project::Fs;
|
||||
use project::{Fs, lsp_store::language_server_settings};
|
||||
use serde_json::json;
|
||||
use smol::fs;
|
||||
use std::{
|
||||
|
@ -14,7 +14,7 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::{ResultExt, maybe};
|
||||
use util::{ResultExt, maybe, merge_json_value_into};
|
||||
|
||||
const SERVER_PATH: &str =
|
||||
"node_modules/vscode-langservers-extracted/bin/vscode-css-language-server";
|
||||
|
@ -134,6 +134,37 @@ impl LspAdapter for CssLspAdapter {
|
|||
"provideFormatter": true
|
||||
})))
|
||||
}
|
||||
|
||||
async fn workspace_configuration(
|
||||
self: Arc<Self>,
|
||||
_: &dyn Fs,
|
||||
delegate: &Arc<dyn LspAdapterDelegate>,
|
||||
_: Arc<dyn LanguageToolchainStore>,
|
||||
cx: &mut AsyncApp,
|
||||
) -> Result<serde_json::Value> {
|
||||
let mut default_config = json!({
|
||||
"css": {
|
||||
"lint": {}
|
||||
},
|
||||
"less": {
|
||||
"lint": {}
|
||||
},
|
||||
"scss": {
|
||||
"lint": {}
|
||||
}
|
||||
});
|
||||
|
||||
let project_options = cx.update(|cx| {
|
||||
language_server_settings(delegate.as_ref(), &self.name(), cx)
|
||||
.and_then(|s| s.settings.clone())
|
||||
})?;
|
||||
|
||||
if let Some(override_options) = project_options {
|
||||
merge_json_value_into(override_options, &mut default_config);
|
||||
}
|
||||
|
||||
Ok(default_config)
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_cached_server_binary(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue