toolchains: Allow users to provide custom paths to toolchains (#37009)
- **toolchains: Add new state to toolchain selector** - **Use toolchain term for Add Toolchain button** - **Hoist out a meta function for toolchain listers** Closes #27332 Release Notes: - python: Users can now specify a custom path to their virtual environment from within the picker. --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
co-authored by
Danilo Leal
parent
59bdbf5a5d
commit
6a7b84eb87
@@ -73,6 +73,7 @@ use postage::stream::Stream;
|
||||
use project::{
|
||||
DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId,
|
||||
debugger::{breakpoint_store::BreakpointStoreEvent, session::ThreadStatus},
|
||||
toolchain_store::ToolchainStoreEvent,
|
||||
};
|
||||
use remote::{RemoteClientDelegate, RemoteConnectionOptions, remote_client::ConnectionIdentifier};
|
||||
use schemars::JsonSchema;
|
||||
@@ -1275,6 +1276,19 @@ impl Workspace {
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
if let Some(toolchain_store) = project.read(cx).toolchain_store() {
|
||||
cx.subscribe_in(
|
||||
&toolchain_store,
|
||||
window,
|
||||
|workspace, _, event, window, cx| match event {
|
||||
ToolchainStoreEvent::CustomToolchainsModified => {
|
||||
workspace.serialize_workspace(window, cx);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
)
|
||||
.detach();
|
||||
}
|
||||
|
||||
cx.on_focus_lost(window, |this, window, cx| {
|
||||
let focus_handle = this.focus_handle(cx);
|
||||
@@ -1565,6 +1579,16 @@ impl Workspace {
|
||||
})?
|
||||
.await;
|
||||
}
|
||||
if let Some(workspace) = serialized_workspace.as_ref() {
|
||||
project_handle.update(cx, |this, cx| {
|
||||
for (scope, toolchains) in &workspace.user_toolchains {
|
||||
for toolchain in toolchains {
|
||||
this.add_toolchain(toolchain.clone(), scope.clone(), cx);
|
||||
}
|
||||
}
|
||||
})?;
|
||||
}
|
||||
|
||||
let window = if let Some(window) = requesting_window {
|
||||
let centered_layout = serialized_workspace
|
||||
.as_ref()
|
||||
@@ -5240,10 +5264,16 @@ impl Workspace {
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
});
|
||||
let user_toolchains = self
|
||||
.project
|
||||
.read(cx)
|
||||
.user_toolchains(cx)
|
||||
.unwrap_or_default();
|
||||
|
||||
let center_group = build_serialized_pane_group(&self.center.root, window, cx);
|
||||
let docks = build_serialized_docks(self, window, cx);
|
||||
let window_bounds = Some(SerializedWindowBounds(window.window_bounds()));
|
||||
|
||||
let serialized_workspace = SerializedWorkspace {
|
||||
id: database_id,
|
||||
location,
|
||||
@@ -5256,6 +5286,7 @@ impl Workspace {
|
||||
session_id: self.session_id.clone(),
|
||||
breakpoints,
|
||||
window_id: Some(window.window_handle().window_id().as_u64()),
|
||||
user_toolchains,
|
||||
};
|
||||
|
||||
window.spawn(cx, async move |_| {
|
||||
|
||||
Reference in New Issue
Block a user