mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Finished graceful terminal failure
This commit is contained in:
parent
40d30a898b
commit
4a483618be
4 changed files with 16 additions and 11 deletions
|
@ -102,10 +102,10 @@
|
||||||
//
|
//
|
||||||
"working_directory": "current_project_directory",
|
"working_directory": "current_project_directory",
|
||||||
//Any key-value pairs added to this list will be added to the terminal's
|
//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
|
//enviroment. Use `:` to seperate multiple values.
|
||||||
"env": [
|
"env": {
|
||||||
//["KEY", "value1:value2"]
|
//"KEY": "value1:value2"
|
||||||
]
|
}
|
||||||
//Set the terminal's font size. If this option is not included,
|
//Set the terminal's font size. If this option is not included,
|
||||||
//the terminal will default to matching the buffer's font size.
|
//the terminal will default to matching the buffer's font size.
|
||||||
//"font_size": "15"
|
//"font_size": "15"
|
||||||
|
|
|
@ -1970,11 +1970,14 @@ impl MutableAppContext {
|
||||||
for model_id in dropped_models {
|
for model_id in dropped_models {
|
||||||
self.subscriptions.lock().remove(&model_id);
|
self.subscriptions.lock().remove(&model_id);
|
||||||
self.observations.lock().remove(&model_id);
|
self.observations.lock().remove(&model_id);
|
||||||
let mut model = self.cx.models.remove(&model_id).unwrap();
|
//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);
|
model.release(self);
|
||||||
self.pending_effects
|
self.pending_effects
|
||||||
.push_back(Effect::ModelRelease { model_id, model });
|
.push_back(Effect::ModelRelease { model_id, model });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (window_id, view_id) in dropped_views {
|
for (window_id, view_id) in dropped_views {
|
||||||
self.subscriptions.lock().remove(&view_id);
|
self.subscriptions.lock().remove(&view_id);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use gpui::{ModelHandle, ViewContext};
|
use gpui::{ModelHandle, ViewContext};
|
||||||
|
use util::ResultExt;
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
use crate::{get_wd_for_workspace, DeployModal, Event, Terminal, TerminalConnection};
|
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| {
|
if let Some(closed_terminal_handle) = workspace.toggle_modal(cx, |workspace, cx| {
|
||||||
let wd = get_wd_for_workspace(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
|
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();
|
.unwrap();
|
||||||
|
|
||||||
let connection_handle = this.read(cx).connection.clone();
|
let connection_handle = this.read(cx).connection.clone();
|
||||||
|
|
|
@ -17,6 +17,7 @@ use project::{LocalWorktree, Project, ProjectPath};
|
||||||
use settings::{Settings, WorkingDirectory};
|
use settings::{Settings, WorkingDirectory};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use util::ResultExt;
|
||||||
use workspace::{Item, Workspace};
|
use workspace::{Item, Workspace};
|
||||||
|
|
||||||
use crate::terminal_element::TerminalEl;
|
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
|
///Create a new Terminal in the current working directory or the user's home directory
|
||||||
fn deploy(workspace: &mut Workspace, _: &Deploy, cx: &mut ViewContext<Workspace>) {
|
fn deploy(workspace: &mut Workspace, _: &Deploy, cx: &mut ViewContext<Workspace>) {
|
||||||
let wd = get_wd_for_workspace(workspace, cx);
|
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);
|
workspace.add_item(Box::new(view), cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue