diff --git a/assets/settings/default.json b/assets/settings/default.json index 73c73636f69d048dc55e4365d4492e7a07f77470..6c34d6be70ebd3193469814e628f6c136335a9d8 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -102,10 +102,10 @@ // "working_directory": "current_project_directory", //Any key-value pairs added to this list will be added to the terminal's - //enviroment. Use `:` to seperate multiple values, not multiple list items - "env": [ - //["KEY", "value1:value2"] - ] + //enviroment. Use `:` to seperate multiple values. + "env": { + //"KEY": "value1:value2" + } //Set the terminal's font size. If this option is not included, //the terminal will default to matching the buffer's font size. //"font_size": "15" diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index db6fe6cdd2032166b944ad9cbb94418b918c3467..547e55699c8b4f89a093cf262b27274996d67ec3 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1970,10 +1970,13 @@ impl MutableAppContext { for model_id in dropped_models { self.subscriptions.lock().remove(&model_id); self.observations.lock().remove(&model_id); - let mut model = self.cx.models.remove(&model_id).unwrap(); - model.release(self); - self.pending_effects - .push_back(Effect::ModelRelease { model_id, model }); + //Model handles and IDs may have been created to instantiate a model without + //finishing successfully (`try_add_model()`) + if let Some(mut model) = self.cx.models.remove(&model_id) { + model.release(self); + self.pending_effects + .push_back(Effect::ModelRelease { model_id, model }); + } } for (window_id, view_id) in dropped_views { diff --git a/crates/terminal/src/modal.rs b/crates/terminal/src/modal.rs index 9d8ae6330bd636d8fe359fece6d8278fc1a906d7..7349ae233efcb285a27d09d05a258647a69c6d16 100644 --- a/crates/terminal/src/modal.rs +++ b/crates/terminal/src/modal.rs @@ -1,4 +1,5 @@ use gpui::{ModelHandle, ViewContext}; +use util::ResultExt; use workspace::Workspace; use crate::{get_wd_for_workspace, DeployModal, Event, Terminal, TerminalConnection}; @@ -26,9 +27,9 @@ pub fn deploy_modal(workspace: &mut Workspace, _: &DeployModal, cx: &mut ViewCon if let Some(closed_terminal_handle) = workspace.toggle_modal(cx, |workspace, cx| { let wd = get_wd_for_workspace(workspace, cx); - //TODO: Anything other than crash. + //TODO: Create a 'failed to launch' view which prints the error and config details. let this = cx - .add_option_view(|cx| Terminal::new(wd, true, cx).ok()) + .add_option_view(|cx| Terminal::new(wd, true, cx).log_err()) .unwrap(); let connection_handle = this.read(cx).connection.clone(); diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 07a029bd8ef50d331383282ec41e7e83a8528a18..605d9533f2237cb14154eb652fa5e0ecd7416a88 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -17,6 +17,7 @@ use project::{LocalWorktree, Project, ProjectPath}; use settings::{Settings, WorkingDirectory}; use smallvec::SmallVec; use std::path::{Path, PathBuf}; +use util::ResultExt; use workspace::{Item, Workspace}; use crate::terminal_element::TerminalEl; @@ -157,7 +158,7 @@ impl Terminal { ///Create a new Terminal in the current working directory or the user's home directory fn deploy(workspace: &mut Workspace, _: &Deploy, cx: &mut ViewContext) { let wd = get_wd_for_workspace(workspace, cx); - if let Some(view) = cx.add_option_view(|cx| Terminal::new(wd, false, cx).ok()) { + if let Some(view) = cx.add_option_view(|cx| Terminal::new(wd, false, cx).log_err()) { workspace.add_item(Box::new(view), cx); } }