python: Fix user settings not getting passed on for Ty (#39174)
Closes #39144 Release Notes: - python: Fixed user settings not being respected with Ty language server.
This commit is contained in:
@@ -154,11 +154,16 @@ impl LspAdapter for TyLspAdapter {
|
|||||||
|
|
||||||
async fn workspace_configuration(
|
async fn workspace_configuration(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
_: &Arc<dyn LspAdapterDelegate>,
|
delegate: &Arc<dyn LspAdapterDelegate>,
|
||||||
toolchain: Option<Toolchain>,
|
toolchain: Option<Toolchain>,
|
||||||
_cx: &mut AsyncApp,
|
cx: &mut AsyncApp,
|
||||||
) -> Result<Value> {
|
) -> Result<Value> {
|
||||||
let mut ret = json!({});
|
let mut ret = cx
|
||||||
|
.update(|cx| {
|
||||||
|
language_server_settings(delegate.as_ref(), &self.name(), cx)
|
||||||
|
.and_then(|s| s.settings.clone())
|
||||||
|
})?
|
||||||
|
.unwrap_or_else(|| json!({}));
|
||||||
if let Some(toolchain) = toolchain.and_then(|toolchain| {
|
if let Some(toolchain) = toolchain.and_then(|toolchain| {
|
||||||
serde_json::from_value::<PythonEnvironment>(toolchain.as_json).ok()
|
serde_json::from_value::<PythonEnvironment>(toolchain.as_json).ok()
|
||||||
}) {
|
}) {
|
||||||
@@ -171,10 +176,9 @@ impl LspAdapter for TyLspAdapter {
|
|||||||
"sysPrefix": sys_prefix
|
"sysPrefix": sys_prefix
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ret.as_object_mut()?.insert(
|
ret.as_object_mut()?
|
||||||
"pythonExtension".into(),
|
.entry("pythonExtension")
|
||||||
json!({ "activeEnvironment": environment }),
|
.or_insert_with(|| json!({ "activeEnvironment": environment }));
|
||||||
);
|
|
||||||
Some(())
|
Some(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -463,7 +467,6 @@ impl LspAdapter for PyrightLspAdapter {
|
|||||||
|
|
||||||
async fn workspace_configuration(
|
async fn workspace_configuration(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
|
|
||||||
adapter: &Arc<dyn LspAdapterDelegate>,
|
adapter: &Arc<dyn LspAdapterDelegate>,
|
||||||
toolchain: Option<Toolchain>,
|
toolchain: Option<Toolchain>,
|
||||||
cx: &mut AsyncApp,
|
cx: &mut AsyncApp,
|
||||||
|
|||||||
Reference in New Issue
Block a user