Remove terminal container view, switch to notify errors
This commit is contained in:
parent
da100a09fb
commit
925c9e13bb
8 changed files with 700 additions and 841 deletions
|
@ -32,13 +32,15 @@ use settings::{
|
|||
use smol::process::Command;
|
||||
use std::fs::OpenOptions;
|
||||
use std::{env, ffi::OsStr, panic, path::PathBuf, sync::Arc, thread, time::Duration};
|
||||
use terminal_view::terminal_container_view::{get_working_directory, TerminalContainer};
|
||||
use terminal_view::{get_working_directory, TerminalView};
|
||||
|
||||
use fs::RealFs;
|
||||
use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJsonFile};
|
||||
use theme::ThemeRegistry;
|
||||
use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt};
|
||||
use workspace::{self, item::ItemHandle, AppState, NewFile, OpenPaths, Workspace};
|
||||
use workspace::{
|
||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
||||
};
|
||||
use zed::{self, build_window_options, initialize_workspace, languages, menus};
|
||||
|
||||
fn main() {
|
||||
|
@ -150,7 +152,7 @@ fn main() {
|
|||
fs,
|
||||
build_window_options,
|
||||
initialize_workspace,
|
||||
default_item_factory,
|
||||
dock_default_item_factory,
|
||||
});
|
||||
auto_update::init(http, client::ZED_SERVER_URL.clone(), cx);
|
||||
|
||||
|
@ -581,10 +583,10 @@ async fn handle_cli_connection(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn default_item_factory(
|
||||
pub fn dock_default_item_factory(
|
||||
workspace: &mut Workspace,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Box<dyn ItemHandle> {
|
||||
) -> Option<Box<dyn ItemHandle>> {
|
||||
let strategy = cx
|
||||
.global::<Settings>()
|
||||
.terminal_overrides
|
||||
|
@ -594,12 +596,15 @@ pub fn default_item_factory(
|
|||
|
||||
let working_directory = get_working_directory(workspace, cx, strategy);
|
||||
|
||||
let terminal_handle = cx.add_view(|cx| {
|
||||
TerminalContainer::new(
|
||||
Err(anyhow!("Don't have a project to open a terminal")),
|
||||
workspace.database_id(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
Box::new(terminal_handle)
|
||||
let window_id = cx.window_id();
|
||||
let terminal = workspace
|
||||
.project()
|
||||
.update(cx, |project, cx| {
|
||||
project.create_terminal(working_directory, window_id, cx)
|
||||
})
|
||||
.notify_err(workspace, cx)?;
|
||||
|
||||
let terminal_view = cx.add_view(|cx| TerminalView::new(terminal, workspace.database_id(), cx));
|
||||
|
||||
Some(Box::new(terminal_view))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue