lsp: Fix initialization_options being used as workspace configuration (#17757)
Release Notes: - Fixed user-configured `initialization_options` being passed as `workspace/Configuration` for the vtsls, TypeScript, and YAML language servers. Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
9db68ee6ae
commit
02d5f320ad
3 changed files with 5 additions and 16 deletions
|
@ -240,7 +240,7 @@ impl LspAdapter for TypeScriptLspAdapter {
|
||||||
) -> Result<Value> {
|
) -> Result<Value> {
|
||||||
let override_options = cx.update(|cx| {
|
let override_options = cx.update(|cx| {
|
||||||
language_server_settings(delegate.as_ref(), Self::SERVER_NAME, cx)
|
language_server_settings(delegate.as_ref(), Self::SERVER_NAME, cx)
|
||||||
.and_then(|s| s.initialization_options.clone())
|
.and_then(|s| s.settings.clone())
|
||||||
})?;
|
})?;
|
||||||
if let Some(options) = override_options {
|
if let Some(options) = override_options {
|
||||||
return Ok(options);
|
return Ok(options);
|
||||||
|
|
|
@ -13,7 +13,7 @@ use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use util::{maybe, merge_json_value_into, ResultExt};
|
use util::{maybe, ResultExt};
|
||||||
|
|
||||||
fn typescript_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
fn typescript_server_binary_arguments(server_path: &Path) -> Vec<OsString> {
|
||||||
vec![server_path.into(), "--stdio".into()]
|
vec![server_path.into(), "--stdio".into()]
|
||||||
|
@ -271,20 +271,9 @@ impl LspAdapter for VtslsLspAdapter {
|
||||||
) -> Result<Value> {
|
) -> Result<Value> {
|
||||||
let override_options = cx.update(|cx| {
|
let override_options = cx.update(|cx| {
|
||||||
language_server_settings(delegate.as_ref(), SERVER_NAME, cx)
|
language_server_settings(delegate.as_ref(), SERVER_NAME, cx)
|
||||||
.and_then(|s| s.initialization_options.clone())
|
.and_then(|s| s.settings.clone())
|
||||||
})?;
|
})?;
|
||||||
if let Some(options) = override_options {
|
Ok(override_options.unwrap_or_default())
|
||||||
return Ok(options);
|
|
||||||
}
|
|
||||||
let mut initialization_options = self
|
|
||||||
.initialization_options(delegate)
|
|
||||||
.await
|
|
||||||
.map(|o| o.unwrap())?;
|
|
||||||
|
|
||||||
if let Some(override_options) = override_options {
|
|
||||||
merge_json_value_into(override_options, &mut initialization_options)
|
|
||||||
}
|
|
||||||
Ok(initialization_options)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn language_ids(&self) -> HashMap<String, String> {
|
fn language_ids(&self) -> HashMap<String, String> {
|
||||||
|
|
|
@ -146,7 +146,7 @@ impl LspAdapter for YamlLspAdapter {
|
||||||
|
|
||||||
let project_options = cx.update(|cx| {
|
let project_options = cx.update(|cx| {
|
||||||
language_server_settings(delegate.as_ref(), Self::SERVER_NAME, cx)
|
language_server_settings(delegate.as_ref(), Self::SERVER_NAME, cx)
|
||||||
.and_then(|s| s.initialization_options.clone())
|
.and_then(|s| s.settings.clone())
|
||||||
})?;
|
})?;
|
||||||
if let Some(override_options) = project_options {
|
if let Some(override_options) = project_options {
|
||||||
merge_json_value_into(override_options, &mut options);
|
merge_json_value_into(override_options, &mut options);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue