Detailed changes
@@ -4463,6 +4463,7 @@ dependencies = [
"smol",
"sum_tree",
"tempdir",
+ "terminal",
"text",
"thiserror",
"toml",
@@ -6257,6 +6258,31 @@ dependencies = [
[[package]]
name = "terminal"
version = "0.1.0"
+dependencies = [
+ "alacritty_terminal",
+ "anyhow",
+ "db",
+ "dirs 4.0.0",
+ "futures 0.3.25",
+ "gpui",
+ "itertools",
+ "lazy_static",
+ "libc",
+ "mio-extras",
+ "ordered-float",
+ "procinfo",
+ "serde",
+ "settings",
+ "shellexpand",
+ "smallvec",
+ "smol",
+ "theme",
+ "thiserror",
+]
+
+[[package]]
+name = "terminal_view"
+version = "0.1.0"
dependencies = [
"alacritty_terminal",
"anyhow",
@@ -8166,7 +8192,7 @@ dependencies = [
"smol",
"sum_tree",
"tempdir",
- "terminal",
+ "terminal_view",
"text",
"theme",
"theme_selector",
@@ -32,6 +32,7 @@ lsp = { path = "../lsp" }
rpc = { path = "../rpc" }
settings = { path = "../settings" }
sum_tree = { path = "../sum_tree" }
+terminal = { path = "../terminal" }
util = { path = "../util" }
aho-corasick = "0.7"
anyhow = "1.0.57"
@@ -60,6 +60,7 @@ use std::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
},
+ thread::panicking,
time::Instant,
};
use thiserror::Error;
@@ -1193,6 +1194,17 @@ impl Project {
!self.is_local()
}
+ pub fn create_terminal_connection(
+ &mut self,
+ cx: &mut ModelContext<Self>,
+ ) -> Result<ModelHandle<TerminalConnection>> {
+ if self.is_remote() {
+ return Err(anyhow!(
+ "creating terminals as a guest is not supported yet"
+ ));
+ }
+ }
+
pub fn create_buffer(
&mut self,
text: &str,
@@ -7,17 +7,12 @@ edition = "2021"
path = "src/terminal.rs"
doctest = false
+
[dependencies]
-context_menu = { path = "../context_menu" }
-editor = { path = "../editor" }
-language = { path = "../language" }
gpui = { path = "../gpui" }
-project = { path = "../project" }
settings = { path = "../settings" }
-theme = { path = "../theme" }
-util = { path = "../util" }
-workspace = { path = "../workspace" }
db = { path = "../db" }
+theme = { path = "../theme" }
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "a51dbe25d67e84d6ed4261e640d3954fbdd9be45" }
procinfo = { git = "https://github.com/zed-industries/wezterm", rev = "5cd757e5f2eb039ed0c6bb6512223e69d5efc64d", default-features = false }
smallvec = { version = "1.6", features = ["union"] }
@@ -32,13 +27,4 @@ libc = "0.2"
anyhow = "1"
thiserror = "1.0"
lazy_static = "1.4.0"
-serde = { version = "1.0", features = ["derive"] }
-
-
-
-[dev-dependencies]
-gpui = { path = "../gpui", features = ["test-support"] }
-client = { path = "../client", features = ["test-support"]}
-project = { path = "../project", features = ["test-support"]}
-workspace = { path = "../workspace", features = ["test-support"] }
-rand = "0.8.5"
+serde = { version = "1.0", features = ["derive"] }
@@ -2,16 +2,16 @@ use std::path::PathBuf;
use db::{define_connection, query, sqlez_macros::sql};
-use workspace::{ItemId, WorkspaceDb, WorkspaceId};
+type ModelId = usize;
define_connection! {
- pub static ref TERMINAL_CONNECTION: TerminalDb<WorkspaceDb> =
+ pub static ref TERMINAL_CONNECTION: TerminalDb<()> =
&[sql!(
CREATE TABLE terminals (
workspace_id INTEGER,
- item_id INTEGER UNIQUE,
+ model_id INTEGER UNIQUE,
working_directory BLOB,
- PRIMARY KEY(workspace_id, item_id),
+ PRIMARY KEY(workspace_id, model_id),
FOREIGN KEY(workspace_id) REFERENCES workspaces(workspace_id)
ON DELETE CASCADE
) STRICT;
@@ -23,7 +23,7 @@ impl TerminalDb {
pub async fn update_workspace_id(
new_id: WorkspaceId,
old_id: WorkspaceId,
- item_id: ItemId
+ item_id: ModelId
) -> Result<()> {
UPDATE terminals
SET workspace_id = ?
@@ -33,7 +33,7 @@ impl TerminalDb {
query! {
pub async fn save_working_directory(
- item_id: ItemId,
+ item_id: ModelId,
workspace_id: WorkspaceId,
working_directory: PathBuf
) -> Result<()> {
@@ -43,7 +43,7 @@ impl TerminalDb {
}
query! {
- pub fn get_working_directory(item_id: ItemId, workspace_id: WorkspaceId) -> Result<Option<PathBuf>> {
+ pub fn get_working_directory(item_id: ModelId, workspace_id: WorkspaceId) -> Result<Option<PathBuf>> {
SELECT working_directory
FROM terminals
WHERE item_id = ? AND workspace_id = ?
@@ -1,8 +1,5 @@
pub mod mappings;
mod persistence;
-pub mod terminal_container_view;
-pub mod terminal_element;
-pub mod terminal_view;
use alacritty_terminal::{
ansi::{ClearMode, Handler},
@@ -37,7 +34,6 @@ use persistence::TERMINAL_CONNECTION;
use procinfo::LocalProcessInfo;
use settings::{AlternateScroll, Settings, Shell, TerminalBlink};
use util::ResultExt;
-use workspace::{ItemId, WorkspaceId};
use std::{
cmp::min,
@@ -0,0 +1,44 @@
+[package]
+name = "terminal_view"
+version = "0.1.0"
+edition = "2021"
+
+[lib]
+path = "src/terminal_container_view.rs"
+doctest = false
+
+[dependencies]
+context_menu = { path = "../context_menu" }
+editor = { path = "../editor" }
+language = { path = "../language" }
+gpui = { path = "../gpui" }
+project = { path = "../project" }
+settings = { path = "../settings" }
+theme = { path = "../theme" }
+util = { path = "../util" }
+workspace = { path = "../workspace" }
+db = { path = "../db" }
+alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "a51dbe25d67e84d6ed4261e640d3954fbdd9be45" }
+procinfo = { git = "https://github.com/zed-industries/wezterm", rev = "5cd757e5f2eb039ed0c6bb6512223e69d5efc64d", default-features = false }
+smallvec = { version = "1.6", features = ["union"] }
+smol = "1.2.5"
+mio-extras = "2.0.6"
+futures = "0.3"
+ordered-float = "2.1.1"
+itertools = "0.10"
+dirs = "4.0.0"
+shellexpand = "2.1.0"
+libc = "0.2"
+anyhow = "1"
+thiserror = "1.0"
+lazy_static = "1.4.0"
+serde = { version = "1.0", features = ["derive"] }
+
+
+
+[dev-dependencies]
+gpui = { path = "../gpui", features = ["test-support"] }
+client = { path = "../client", features = ["test-support"]}
+project = { path = "../project", features = ["test-support"]}
+workspace = { path = "../workspace", features = ["test-support"] }
+rand = "0.8.5"
@@ -48,7 +48,7 @@ rpc = { path = "../rpc" }
settings = { path = "../settings" }
sum_tree = { path = "../sum_tree" }
text = { path = "../text" }
-terminal = { path = "../terminal" }
+terminal_view = { path = "../terminal_view" }
theme = { path = "../theme" }
theme_selector = { path = "../theme_selector" }
theme_testbench = { path = "../theme_testbench" }