Merge branch 'main' into markdown-fenced-blocks
This commit is contained in:
commit
dff08d3cfe
81 changed files with 823 additions and 171 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -41,16 +41,19 @@ jobs:
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --workspace --no-fail-fast
|
run: cargo test --workspace --no-fail-fast
|
||||||
|
|
||||||
- name: Build collab
|
- name: Build collab
|
||||||
run: cargo build -p collab
|
run: cargo build -p collab
|
||||||
|
|
||||||
- name: Build other binaries
|
- name: Build other binaries
|
||||||
run: cargo build --workspace --bins --all-features
|
run: cargo build --workspace --bins --all-features
|
||||||
|
|
||||||
|
- name: Generate license file
|
||||||
|
run: script/generate-licenses
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
name: Bundle app
|
name: Bundle app
|
||||||
runs-on:
|
runs-on:
|
||||||
|
@ -109,6 +112,9 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Generate license file
|
||||||
|
run: script/generate-licenses
|
||||||
|
|
||||||
- name: Create app bundle
|
- name: Create app bundle
|
||||||
run: script/bundle
|
run: script/bundle
|
||||||
|
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
||||||
/assets/themes/*.json
|
/assets/themes/*.json
|
||||||
/assets/themes/Internal/*.json
|
/assets/themes/Internal/*.json
|
||||||
/assets/themes/Experiments/*.json
|
/assets/themes/Experiments/*.json
|
||||||
|
/assets/licenses.md
|
||||||
**/venv
|
**/venv
|
||||||
.build
|
.build
|
||||||
Packages
|
Packages
|
||||||
|
|
35
Cargo.lock
generated
35
Cargo.lock
generated
|
@ -2021,6 +2021,33 @@ dependencies = [
|
||||||
"instant",
|
"instant",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "feedback"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"client",
|
||||||
|
"editor",
|
||||||
|
"futures 0.3.25",
|
||||||
|
"gpui",
|
||||||
|
"human_bytes",
|
||||||
|
"isahc",
|
||||||
|
"language",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"postage",
|
||||||
|
"project",
|
||||||
|
"search",
|
||||||
|
"serde",
|
||||||
|
"settings",
|
||||||
|
"sysinfo",
|
||||||
|
"theme",
|
||||||
|
"tree-sitter-markdown",
|
||||||
|
"urlencoding",
|
||||||
|
"util",
|
||||||
|
"workspace",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "file-per-thread-logger"
|
name = "file-per-thread-logger"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
|
@ -6241,9 +6268,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sysinfo"
|
name = "sysinfo"
|
||||||
version = "0.27.1"
|
version = "0.27.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccb297c0afb439440834b4bcf02c5c9da8ec2e808e70f36b0d8e815ff403bd24"
|
checksum = "1620f9573034c573376acc550f3b9a2be96daeb08abb3c12c8523e1cee06e80f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
|
@ -8214,6 +8241,7 @@ dependencies = [
|
||||||
"easy-parallel",
|
"easy-parallel",
|
||||||
"editor",
|
"editor",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"feedback",
|
||||||
"file_finder",
|
"file_finder",
|
||||||
"fs",
|
"fs",
|
||||||
"fsevent",
|
"fsevent",
|
||||||
|
@ -8221,7 +8249,6 @@ dependencies = [
|
||||||
"fuzzy",
|
"fuzzy",
|
||||||
"go_to_line",
|
"go_to_line",
|
||||||
"gpui",
|
"gpui",
|
||||||
"human_bytes",
|
|
||||||
"ignore",
|
"ignore",
|
||||||
"image",
|
"image",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
@ -8255,7 +8282,6 @@ dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"smol",
|
"smol",
|
||||||
"sum_tree",
|
"sum_tree",
|
||||||
"sysinfo",
|
|
||||||
"tempdir",
|
"tempdir",
|
||||||
"terminal_view",
|
"terminal_view",
|
||||||
"text",
|
"text",
|
||||||
|
@ -8284,7 +8310,6 @@ dependencies = [
|
||||||
"tree-sitter-typescript",
|
"tree-sitter-typescript",
|
||||||
"unindent",
|
"unindent",
|
||||||
"url",
|
"url",
|
||||||
"urlencoding",
|
|
||||||
"util",
|
"util",
|
||||||
"vim",
|
"vim",
|
||||||
"workspace",
|
"workspace",
|
||||||
|
|
|
@ -17,6 +17,7 @@ members = [
|
||||||
"crates/diagnostics",
|
"crates/diagnostics",
|
||||||
"crates/drag_and_drop",
|
"crates/drag_and_drop",
|
||||||
"crates/editor",
|
"crates/editor",
|
||||||
|
"crates/feedback",
|
||||||
"crates/file_finder",
|
"crates/file_finder",
|
||||||
"crates/fs",
|
"crates/fs",
|
||||||
"crates/fsevent",
|
"crates/fsevent",
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "activity_indicator"
|
name = "activity_indicator"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/activity_indicator.rs"
|
path = "src/activity_indicator.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "assets"
|
name = "assets"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/assets.rs"
|
path = "src/assets.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "auto_update"
|
name = "auto_update"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/auto_update.rs"
|
path = "src/auto_update.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "breadcrumbs"
|
name = "breadcrumbs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/breadcrumbs.rs"
|
path = "src/breadcrumbs.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "call"
|
name = "call"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/call.rs"
|
path = "src/call.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "cli"
|
name = "cli"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/cli.rs"
|
path = "src/cli.rs"
|
||||||
|
|
|
@ -9,7 +9,13 @@ use core_foundation::{
|
||||||
use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType};
|
use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec, TCFType};
|
||||||
use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{IpcOneShotServer, IpcReceiver, IpcSender};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::{ffi::OsStr, fs, path::PathBuf, ptr};
|
use std::{
|
||||||
|
ffi::OsStr,
|
||||||
|
fs::{self, OpenOptions},
|
||||||
|
io,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
ptr,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))]
|
#[clap(name = "zed", global_setting(clap::AppSettings::NoAutoVersion))]
|
||||||
|
@ -54,6 +60,12 @@ fn main() -> Result<()> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for path in args.paths.iter() {
|
||||||
|
if !path.exists() {
|
||||||
|
touch(path.as_path())?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (tx, rx) = launch_app(bundle_path)?;
|
let (tx, rx) = launch_app(bundle_path)?;
|
||||||
|
|
||||||
tx.send(CliRequest::Open {
|
tx.send(CliRequest::Open {
|
||||||
|
@ -77,6 +89,13 @@ fn main() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn touch(path: &Path) -> io::Result<()> {
|
||||||
|
match OpenOptions::new().create(true).write(true).open(path) {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn locate_bundle() -> Result<PathBuf> {
|
fn locate_bundle() -> Result<PathBuf> {
|
||||||
let cli_path = std::env::current_exe()?.canonicalize()?;
|
let cli_path = std::env::current_exe()?.canonicalize()?;
|
||||||
let mut app_path = cli_path.clone();
|
let mut app_path = cli_path.clone();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "client"
|
name = "client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/client.rs"
|
path = "src/client.rs"
|
||||||
|
|
|
@ -1315,6 +1315,10 @@ impl Client {
|
||||||
pub fn telemetry_log_file_path(&self) -> Option<PathBuf> {
|
pub fn telemetry_log_file_path(&self) -> Option<PathBuf> {
|
||||||
self.telemetry.log_file_path()
|
self.telemetry.log_file_path()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn metrics_id(&self) -> Option<Arc<str>> {
|
||||||
|
self.telemetry.metrics_id()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WeakSubscriber {
|
impl WeakSubscriber {
|
||||||
|
|
|
@ -278,6 +278,10 @@ impl Telemetry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn metrics_id(self: &Arc<Self>) -> Option<Arc<str>> {
|
||||||
|
self.state.lock().metrics_id.clone()
|
||||||
|
}
|
||||||
|
|
||||||
fn flush(self: &Arc<Self>) {
|
fn flush(self: &Arc<Self>) {
|
||||||
let mut state = self.state.lock();
|
let mut state = self.state.lock();
|
||||||
let mut events = mem::take(&mut state.queue);
|
let mut events = mem::take(&mut state.queue);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "clock"
|
name = "clock"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/clock.rs"
|
path = "src/clock.rs"
|
||||||
|
|
|
@ -4,6 +4,7 @@ default-run = "collab"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "collab"
|
name = "collab"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "collab"
|
name = "collab"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "collab_ui"
|
name = "collab_ui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/collab_ui.rs"
|
path = "src/collab_ui.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "collections"
|
name = "collections"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/collections.rs"
|
path = "src/collections.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "command_palette"
|
name = "command_palette"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/command_palette.rs"
|
path = "src/command_palette.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "context_menu"
|
name = "context_menu"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/context_menu.rs"
|
path = "src/context_menu.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "db"
|
name = "db"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/db.rs"
|
path = "src/db.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "diagnostics"
|
name = "diagnostics"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/diagnostics.rs"
|
path = "src/diagnostics.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "drag_and_drop"
|
name = "drag_and_drop"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/drag_and_drop.rs"
|
path = "src/drag_and_drop.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "editor"
|
name = "editor"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/editor.rs"
|
path = "src/editor.rs"
|
||||||
|
|
|
@ -1008,6 +1008,15 @@ impl Editor {
|
||||||
Self::new(EditorMode::SingleLine, buffer, None, field_editor_style, cx)
|
Self::new(EditorMode::SingleLine, buffer, None, field_editor_style, cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn multi_line(
|
||||||
|
field_editor_style: Option<Arc<GetFieldEditorTheme>>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Self {
|
||||||
|
let buffer = cx.add_model(|cx| Buffer::new(0, String::new(), cx));
|
||||||
|
let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx));
|
||||||
|
Self::new(EditorMode::Full, buffer, None, field_editor_style, cx)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn auto_height(
|
pub fn auto_height(
|
||||||
max_lines: usize,
|
max_lines: usize,
|
||||||
field_editor_style: Option<Arc<GetFieldEditorTheme>>,
|
field_editor_style: Option<Arc<GetFieldEditorTheme>>,
|
||||||
|
|
34
crates/feedback/Cargo.toml
Normal file
34
crates/feedback/Cargo.toml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[package]
|
||||||
|
name = "feedback"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/feedback.rs"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
test-support = []
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.38"
|
||||||
|
client = { path = "../client" }
|
||||||
|
editor = { path = "../editor" }
|
||||||
|
language = { path = "../language" }
|
||||||
|
log = "0.4"
|
||||||
|
futures = "0.3"
|
||||||
|
gpui = { path = "../gpui" }
|
||||||
|
human_bytes = "0.4.1"
|
||||||
|
isahc = "1.7"
|
||||||
|
lazy_static = "1.4.0"
|
||||||
|
postage = { version = "0.4", features = ["futures-traits"] }
|
||||||
|
project = { path = "../project" }
|
||||||
|
search = { path = "../search" }
|
||||||
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
|
settings = { path = "../settings" }
|
||||||
|
sysinfo = "0.27.1"
|
||||||
|
theme = { path = "../theme" }
|
||||||
|
tree-sitter-markdown = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "330ecab87a3e3a7211ac69bbadc19eabecdb1cca" }
|
||||||
|
urlencoding = "2.1.2"
|
||||||
|
util = { path = "../util" }
|
||||||
|
workspace = { path = "../workspace" }
|
61
crates/feedback/src/feedback.rs
Normal file
61
crates/feedback/src/feedback.rs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
pub mod feedback_editor;
|
||||||
|
mod system_specs;
|
||||||
|
use gpui::{actions, impl_actions, ClipboardItem, ViewContext};
|
||||||
|
use serde::Deserialize;
|
||||||
|
use system_specs::SystemSpecs;
|
||||||
|
use workspace::Workspace;
|
||||||
|
|
||||||
|
#[derive(Deserialize, Clone, PartialEq)]
|
||||||
|
pub struct OpenBrowser {
|
||||||
|
pub url: Arc<str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_actions!(zed, [OpenBrowser]);
|
||||||
|
|
||||||
|
actions!(
|
||||||
|
zed,
|
||||||
|
[CopySystemSpecsIntoClipboard, FileBugReport, RequestFeature,]
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn init(cx: &mut gpui::MutableAppContext) {
|
||||||
|
feedback_editor::init(cx);
|
||||||
|
|
||||||
|
cx.add_global_action(move |action: &OpenBrowser, cx| cx.platform().open_url(&action.url));
|
||||||
|
|
||||||
|
cx.add_action(
|
||||||
|
|_: &mut Workspace, _: &CopySystemSpecsIntoClipboard, cx: &mut ViewContext<Workspace>| {
|
||||||
|
let system_specs = SystemSpecs::new(cx).to_string();
|
||||||
|
let item = ClipboardItem::new(system_specs.clone());
|
||||||
|
cx.prompt(
|
||||||
|
gpui::PromptLevel::Info,
|
||||||
|
&format!("Copied into clipboard:\n\n{system_specs}"),
|
||||||
|
&["OK"],
|
||||||
|
);
|
||||||
|
cx.write_to_clipboard(item);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
cx.add_action(
|
||||||
|
|_: &mut Workspace, _: &RequestFeature, cx: &mut ViewContext<Workspace>| {
|
||||||
|
let url = "https://github.com/zed-industries/feedback/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml";
|
||||||
|
cx.dispatch_action(OpenBrowser {
|
||||||
|
url: url.into(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
cx.add_action(
|
||||||
|
|_: &mut Workspace, _: &FileBugReport, cx: &mut ViewContext<Workspace>| {
|
||||||
|
let system_specs_text = SystemSpecs::new(cx).to_string();
|
||||||
|
let url = format!(
|
||||||
|
"https://github.com/zed-industries/feedback/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml&environment={}",
|
||||||
|
urlencoding::encode(&system_specs_text)
|
||||||
|
);
|
||||||
|
cx.dispatch_action(OpenBrowser {
|
||||||
|
url: url.into(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
417
crates/feedback/src/feedback_editor.rs
Normal file
417
crates/feedback/src/feedback_editor.rs
Normal file
|
@ -0,0 +1,417 @@
|
||||||
|
use std::{ops::Range, sync::Arc};
|
||||||
|
|
||||||
|
use anyhow::bail;
|
||||||
|
use client::{Client, ZED_SECRET_CLIENT_TOKEN};
|
||||||
|
use editor::{Anchor, Editor};
|
||||||
|
use futures::AsyncReadExt;
|
||||||
|
use gpui::{
|
||||||
|
actions,
|
||||||
|
elements::{ChildView, Flex, Label, MouseEventHandler, ParentElement, Stack, Text},
|
||||||
|
serde_json, AnyViewHandle, AppContext, CursorStyle, Element, ElementBox, Entity, ModelHandle,
|
||||||
|
MouseButton, MutableAppContext, PromptLevel, RenderContext, Task, View, ViewContext,
|
||||||
|
ViewHandle,
|
||||||
|
};
|
||||||
|
use isahc::Request;
|
||||||
|
use language::Buffer;
|
||||||
|
use postage::prelude::Stream;
|
||||||
|
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use project::Project;
|
||||||
|
use serde::Serialize;
|
||||||
|
use settings::Settings;
|
||||||
|
use workspace::{
|
||||||
|
item::{Item, ItemHandle},
|
||||||
|
searchable::{SearchableItem, SearchableItemHandle},
|
||||||
|
StatusItemView, Workspace,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::system_specs::SystemSpecs;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
pub static ref ZED_SERVER_URL: String =
|
||||||
|
std::env::var("ZED_SERVER_URL").unwrap_or_else(|_| "https://zed.dev".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
const FEEDBACK_CHAR_COUNT_RANGE: Range<usize> = Range {
|
||||||
|
start: 10,
|
||||||
|
end: 1000,
|
||||||
|
};
|
||||||
|
|
||||||
|
const FEEDBACK_PLACEHOLDER_TEXT: &str = "Thanks for spending time with Zed. Enter your feedback here as Markdown. Save the tab to submit your feedback.";
|
||||||
|
const FEEDBACK_SUBMISSION_ERROR_TEXT: &str =
|
||||||
|
"Feedback failed to submit, see error log for details.";
|
||||||
|
|
||||||
|
actions!(feedback, [SubmitFeedback, GiveFeedback, DeployFeedback]);
|
||||||
|
|
||||||
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
|
cx.add_action(FeedbackEditor::deploy);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FeedbackButton;
|
||||||
|
|
||||||
|
impl Entity for FeedbackButton {
|
||||||
|
type Event = ();
|
||||||
|
}
|
||||||
|
|
||||||
|
impl View for FeedbackButton {
|
||||||
|
fn ui_name() -> &'static str {
|
||||||
|
"FeedbackButton"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> ElementBox {
|
||||||
|
Stack::new()
|
||||||
|
.with_child(
|
||||||
|
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
||||||
|
let theme = &cx.global::<Settings>().theme;
|
||||||
|
let theme = &theme.workspace.status_bar.feedback;
|
||||||
|
|
||||||
|
Text::new(
|
||||||
|
"Give Feedback".to_string(),
|
||||||
|
theme.style_for(state, true).clone(),
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
|
})
|
||||||
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
|
.on_click(MouseButton::Left, |_, cx| cx.dispatch_action(GiveFeedback))
|
||||||
|
.boxed(),
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StatusItemView for FeedbackButton {
|
||||||
|
fn set_active_pane_item(
|
||||||
|
&mut self,
|
||||||
|
_: Option<&dyn ItemHandle>,
|
||||||
|
_: &mut gpui::ViewContext<Self>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
struct FeedbackRequestBody<'a> {
|
||||||
|
feedback_text: &'a str,
|
||||||
|
metrics_id: Option<Arc<str>>,
|
||||||
|
system_specs: SystemSpecs,
|
||||||
|
token: &'a str,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct FeedbackEditor {
|
||||||
|
editor: ViewHandle<Editor>,
|
||||||
|
project: ModelHandle<Project>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FeedbackEditor {
|
||||||
|
fn new_with_buffer(
|
||||||
|
project: ModelHandle<Project>,
|
||||||
|
buffer: ModelHandle<Buffer>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Self {
|
||||||
|
let editor = cx.add_view(|cx| {
|
||||||
|
let mut editor = Editor::for_buffer(buffer, Some(project.clone()), cx);
|
||||||
|
editor.set_vertical_scroll_margin(5, cx);
|
||||||
|
editor.set_placeholder_text(FEEDBACK_PLACEHOLDER_TEXT, cx);
|
||||||
|
editor
|
||||||
|
});
|
||||||
|
|
||||||
|
cx.subscribe(&editor, |_, _, e, cx| cx.emit(e.clone()))
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
let this = Self { editor, project };
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new(project: ModelHandle<Project>, cx: &mut ViewContext<Self>) -> Self {
|
||||||
|
let markdown_language = project.read(cx).languages().get_language("Markdown");
|
||||||
|
|
||||||
|
let buffer = project
|
||||||
|
.update(cx, |project, cx| {
|
||||||
|
project.create_buffer("", markdown_language, cx)
|
||||||
|
})
|
||||||
|
.expect("creating buffers on a local workspace always succeeds");
|
||||||
|
|
||||||
|
Self::new_with_buffer(project, buffer, cx)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_save(
|
||||||
|
&mut self,
|
||||||
|
_: gpui::ModelHandle<Project>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Task<anyhow::Result<()>> {
|
||||||
|
let feedback_text_length = self.editor.read(cx).buffer().read(cx).len(cx);
|
||||||
|
|
||||||
|
if feedback_text_length <= FEEDBACK_CHAR_COUNT_RANGE.start {
|
||||||
|
cx.prompt(
|
||||||
|
PromptLevel::Critical,
|
||||||
|
&format!(
|
||||||
|
"Feedback must be longer than {} characters",
|
||||||
|
FEEDBACK_CHAR_COUNT_RANGE.start
|
||||||
|
),
|
||||||
|
&["OK"],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Task::ready(Ok(()));
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut answer = cx.prompt(
|
||||||
|
PromptLevel::Info,
|
||||||
|
"Ready to submit your feedback?",
|
||||||
|
&["Yes, Submit!", "No"],
|
||||||
|
);
|
||||||
|
|
||||||
|
let this = cx.handle();
|
||||||
|
let client = cx.global::<Arc<Client>>().clone();
|
||||||
|
let feedback_text = self.editor.read(cx).text(cx);
|
||||||
|
let specs = SystemSpecs::new(cx);
|
||||||
|
|
||||||
|
cx.spawn(|_, mut cx| async move {
|
||||||
|
let answer = answer.recv().await;
|
||||||
|
|
||||||
|
if answer == Some(0) {
|
||||||
|
match FeedbackEditor::submit_feedback(&feedback_text, client, specs).await {
|
||||||
|
Ok(_) => {
|
||||||
|
cx.update(|cx| {
|
||||||
|
this.update(cx, |_, cx| {
|
||||||
|
cx.dispatch_action(workspace::CloseActiveItem);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("{}", error);
|
||||||
|
|
||||||
|
cx.update(|cx| {
|
||||||
|
this.update(cx, |_, cx| {
|
||||||
|
cx.prompt(
|
||||||
|
PromptLevel::Critical,
|
||||||
|
FEEDBACK_SUBMISSION_ERROR_TEXT,
|
||||||
|
&["OK"],
|
||||||
|
);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
|
||||||
|
Task::ready(Ok(()))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn submit_feedback(
|
||||||
|
feedback_text: &str,
|
||||||
|
zed_client: Arc<Client>,
|
||||||
|
system_specs: SystemSpecs,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let feedback_endpoint = format!("{}/api/feedback", *ZED_SERVER_URL);
|
||||||
|
|
||||||
|
let metrics_id = zed_client.metrics_id();
|
||||||
|
let http_client = zed_client.http_client();
|
||||||
|
|
||||||
|
let request = FeedbackRequestBody {
|
||||||
|
feedback_text: &feedback_text,
|
||||||
|
metrics_id,
|
||||||
|
system_specs,
|
||||||
|
token: ZED_SECRET_CLIENT_TOKEN,
|
||||||
|
};
|
||||||
|
|
||||||
|
let json_bytes = serde_json::to_vec(&request)?;
|
||||||
|
|
||||||
|
let request = Request::post(feedback_endpoint)
|
||||||
|
.header("content-type", "application/json")
|
||||||
|
.body(json_bytes.into())?;
|
||||||
|
|
||||||
|
let mut response = http_client.send(request).await?;
|
||||||
|
let mut body = String::new();
|
||||||
|
response.body_mut().read_to_string(&mut body).await?;
|
||||||
|
|
||||||
|
let response_status = response.status();
|
||||||
|
|
||||||
|
if !response_status.is_success() {
|
||||||
|
bail!("Feedback API failed with error: {}", response_status)
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FeedbackEditor {
|
||||||
|
pub fn deploy(workspace: &mut Workspace, _: &GiveFeedback, cx: &mut ViewContext<Workspace>) {
|
||||||
|
let feedback_editor =
|
||||||
|
cx.add_view(|cx| FeedbackEditor::new(workspace.project().clone(), cx));
|
||||||
|
workspace.add_item(Box::new(feedback_editor), cx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl View for FeedbackEditor {
|
||||||
|
fn ui_name() -> &'static str {
|
||||||
|
"FeedbackEditor"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
|
ChildView::new(&self.editor, cx).boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
||||||
|
if cx.is_self_focused() {
|
||||||
|
cx.focus(&self.editor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Entity for FeedbackEditor {
|
||||||
|
type Event = editor::Event;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Item for FeedbackEditor {
|
||||||
|
fn tab_content(
|
||||||
|
&self,
|
||||||
|
_: Option<usize>,
|
||||||
|
style: &theme::Tab,
|
||||||
|
_: &gpui::AppContext,
|
||||||
|
) -> ElementBox {
|
||||||
|
Flex::row()
|
||||||
|
.with_child(
|
||||||
|
Label::new("Feedback".to_string(), style.label.clone())
|
||||||
|
.aligned()
|
||||||
|
.contained()
|
||||||
|
.boxed(),
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn for_each_project_item(&self, cx: &AppContext, f: &mut dyn FnMut(usize, &dyn project::Item)) {
|
||||||
|
self.editor.for_each_project_item(cx, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_item_events(_: &Self::Event) -> Vec<workspace::item::ItemEvent> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_singleton(&self, _: &gpui::AppContext) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_nav_history(&mut self, _: workspace::ItemNavHistory, _: &mut ViewContext<Self>) {}
|
||||||
|
|
||||||
|
fn can_save(&self, _: &gpui::AppContext) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn save(
|
||||||
|
&mut self,
|
||||||
|
project: gpui::ModelHandle<Project>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Task<anyhow::Result<()>> {
|
||||||
|
self.handle_save(project, cx)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn save_as(
|
||||||
|
&mut self,
|
||||||
|
project: gpui::ModelHandle<Project>,
|
||||||
|
_: std::path::PathBuf,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Task<anyhow::Result<()>> {
|
||||||
|
self.handle_save(project, cx)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reload(
|
||||||
|
&mut self,
|
||||||
|
_: gpui::ModelHandle<Project>,
|
||||||
|
_: &mut ViewContext<Self>,
|
||||||
|
) -> Task<anyhow::Result<()>> {
|
||||||
|
unreachable!("reload should not have been called")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn clone_on_split(
|
||||||
|
&self,
|
||||||
|
_workspace_id: workspace::WorkspaceId,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Option<Self>
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
let buffer = self
|
||||||
|
.editor
|
||||||
|
.read(cx)
|
||||||
|
.buffer()
|
||||||
|
.read(cx)
|
||||||
|
.as_singleton()
|
||||||
|
.expect("Feedback buffer is only ever singleton");
|
||||||
|
|
||||||
|
Some(Self::new_with_buffer(
|
||||||
|
self.project.clone(),
|
||||||
|
buffer.clone(),
|
||||||
|
cx,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn serialized_item_kind() -> Option<&'static str> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn deserialize(
|
||||||
|
_: gpui::ModelHandle<Project>,
|
||||||
|
_: gpui::WeakViewHandle<Workspace>,
|
||||||
|
_: workspace::WorkspaceId,
|
||||||
|
_: workspace::ItemId,
|
||||||
|
_: &mut ViewContext<workspace::Pane>,
|
||||||
|
) -> Task<anyhow::Result<ViewHandle<Self>>> {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn as_searchable(&self, handle: &ViewHandle<Self>) -> Option<Box<dyn SearchableItemHandle>> {
|
||||||
|
Some(Box::new(handle.clone()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SearchableItem for FeedbackEditor {
|
||||||
|
type Match = Range<Anchor>;
|
||||||
|
|
||||||
|
fn to_search_event(event: &Self::Event) -> Option<workspace::searchable::SearchEvent> {
|
||||||
|
Editor::to_search_event(event)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn clear_matches(&mut self, cx: &mut ViewContext<Self>) {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.clear_matches(cx))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_matches(&mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<Self>) {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.update_matches(matches, cx))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn query_suggestion(&mut self, cx: &mut ViewContext<Self>) -> String {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.query_suggestion(cx))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn activate_match(
|
||||||
|
&mut self,
|
||||||
|
index: usize,
|
||||||
|
matches: Vec<Self::Match>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.activate_match(index, matches, cx))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn find_matches(
|
||||||
|
&mut self,
|
||||||
|
query: project::search::SearchQuery,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Task<Vec<Self::Match>> {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.find_matches(query, cx))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn active_match_index(
|
||||||
|
&mut self,
|
||||||
|
matches: Vec<Self::Match>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Option<usize> {
|
||||||
|
self.editor
|
||||||
|
.update(cx, |editor, cx| editor.active_match_index(matches, cx))
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,9 +2,11 @@ use std::{env, fmt::Display};
|
||||||
|
|
||||||
use gpui::AppContext;
|
use gpui::AppContext;
|
||||||
use human_bytes::human_bytes;
|
use human_bytes::human_bytes;
|
||||||
|
use serde::Serialize;
|
||||||
use sysinfo::{System, SystemExt};
|
use sysinfo::{System, SystemExt};
|
||||||
use util::channel::ReleaseChannel;
|
use util::channel::ReleaseChannel;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
pub struct SystemSpecs {
|
pub struct SystemSpecs {
|
||||||
app_version: &'static str,
|
app_version: &'static str,
|
||||||
release_channel: &'static str,
|
release_channel: &'static str,
|
||||||
|
@ -40,7 +42,7 @@ impl Display for SystemSpecs {
|
||||||
None => format!("OS: {}", self.os_name),
|
None => format!("OS: {}", self.os_name),
|
||||||
};
|
};
|
||||||
let system_specs = [
|
let system_specs = [
|
||||||
format!("Zed: {} ({})", self.app_version, self.release_channel),
|
format!("Zed: v{} ({})", self.app_version, self.release_channel),
|
||||||
os_information,
|
os_information,
|
||||||
format!("Memory: {}", human_bytes(self.memory as f64)),
|
format!("Memory: {}", human_bytes(self.memory as f64)),
|
||||||
format!("Architecture: {}", self.architecture),
|
format!("Architecture: {}", self.architecture),
|
|
@ -2,6 +2,7 @@
|
||||||
name = "file_finder"
|
name = "file_finder"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/file_finder.rs"
|
path = "src/file_finder.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "fs"
|
name = "fs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/fs.rs"
|
path = "src/fs.rs"
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "fsevent"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/fsevent.rs"
|
path = "src/fsevent.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "fuzzy"
|
name = "fuzzy"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/fuzzy.rs"
|
path = "src/fuzzy.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "git"
|
name = "git"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/git.rs"
|
path = "src/git.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "go_to_line"
|
name = "go_to_line"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/go_to_line.rs"
|
path = "src/go_to_line.rs"
|
||||||
|
|
|
@ -4,6 +4,7 @@ edition = "2021"
|
||||||
name = "gpui"
|
name = "gpui"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A GPU-accelerated UI framework"
|
description = "A GPU-accelerated UI framework"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/gpui.rs"
|
path = "src/gpui.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "gpui_macros"
|
name = "gpui_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/gpui_macros.rs"
|
path = "src/gpui_macros.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "journal"
|
name = "journal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/journal.rs"
|
path = "src/journal.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "language"
|
name = "language"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/language.rs"
|
path = "src/language.rs"
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "live_kit_client"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Bindings to LiveKit Swift client SDK"
|
description = "Bindings to LiveKit Swift client SDK"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/live_kit_client.rs"
|
path = "src/live_kit_client.rs"
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "live_kit_server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "SDK for the LiveKit server API"
|
description = "SDK for the LiveKit server API"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/live_kit_server.rs"
|
path = "src/live_kit_server.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "lsp"
|
name = "lsp"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/lsp.rs"
|
path = "src/lsp.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "media"
|
name = "media"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/media.rs"
|
path = "src/media.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "menu"
|
name = "menu"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/menu.rs"
|
path = "src/menu.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "outline"
|
name = "outline"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/outline.rs"
|
path = "src/outline.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "picker"
|
name = "picker"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/picker.rs"
|
path = "src/picker.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "plugin"
|
name = "plugin"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "plugin_macros"
|
name = "plugin_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "plugin_runtime"
|
name = "plugin_runtime"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmtime = "0.38"
|
wasmtime = "0.38"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "project"
|
name = "project"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/project.rs"
|
path = "src/project.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "project_panel"
|
name = "project_panel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/project_panel.rs"
|
path = "src/project_panel.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "project_symbols"
|
name = "project_symbols"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/project_symbols.rs"
|
path = "src/project_symbols.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "recent_projects"
|
name = "recent_projects"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/recent_projects.rs"
|
path = "src/recent_projects.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "rope"
|
name = "rope"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/rope.rs"
|
path = "src/rope.rs"
|
||||||
|
|
|
@ -3,6 +3,7 @@ description = "Shared logic for communication between the Zed app and the zed.de
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "rpc"
|
name = "rpc"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/rpc.rs"
|
path = "src/rpc.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "search"
|
name = "search"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/search.rs"
|
path = "src/search.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "settings"
|
name = "settings"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/settings.rs"
|
path = "src/settings.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "snippet"
|
name = "snippet"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/snippet.rs"
|
path = "src/snippet.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "sqlez"
|
name = "sqlez"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "sqlez_macros"
|
name = "sqlez_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/sqlez_macros.rs"
|
path = "src/sqlez_macros.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "sum_tree"
|
name = "sum_tree"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/sum_tree.rs"
|
path = "src/sum_tree.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "terminal"
|
name = "terminal"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/terminal.rs"
|
path = "src/terminal.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "terminal_view"
|
name = "terminal_view"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/terminal_view.rs"
|
path = "src/terminal_view.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "text"
|
name = "text"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/text.rs"
|
path = "src/text.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "theme"
|
name = "theme"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/theme.rs"
|
path = "src/theme.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "theme_selector"
|
name = "theme_selector"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/theme_selector.rs"
|
path = "src/theme_selector.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "theme_testbench"
|
name = "theme_testbench"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/theme_testbench.rs"
|
path = "src/theme_testbench.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "util"
|
name = "util"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "vim"
|
name = "vim"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/vim.rs"
|
path = "src/vim.rs"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "workspace"
|
name = "workspace"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "src/workspace.rs"
|
path = "src/workspace.rs"
|
||||||
|
|
|
@ -103,7 +103,7 @@ impl_internal_actions!(
|
||||||
DeploySplitMenu,
|
DeploySplitMenu,
|
||||||
DeployNewMenu,
|
DeployNewMenu,
|
||||||
DeployDockMenu,
|
DeployDockMenu,
|
||||||
MoveItem,
|
MoveItem
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1150,7 +1150,7 @@ impl Pane {
|
||||||
|
|
||||||
row.add_child({
|
row.add_child({
|
||||||
enum Tab {}
|
enum Tab {}
|
||||||
dragged_item_receiver::<Tab, _>(ix, ix, true, None, cx, {
|
let mut receiver = dragged_item_receiver::<Tab, _>(ix, ix, true, None, cx, {
|
||||||
let item = item.clone();
|
let item = item.clone();
|
||||||
let pane = pane.clone();
|
let pane = pane.clone();
|
||||||
let detail = detail.clone();
|
let detail = detail.clone();
|
||||||
|
@ -1162,50 +1162,51 @@ impl Pane {
|
||||||
let hovered = mouse_state.hovered();
|
let hovered = mouse_state.hovered();
|
||||||
Self::render_tab(&item, pane, ix == 0, detail, hovered, tab_style, cx)
|
Self::render_tab(&item, pane, ix == 0, detail, hovered, tab_style, cx)
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
.with_cursor_style(if pane_active && tab_active {
|
|
||||||
CursorStyle::Arrow
|
|
||||||
} else {
|
|
||||||
CursorStyle::PointingHand
|
|
||||||
})
|
|
||||||
.on_down(MouseButton::Left, move |_, cx| {
|
|
||||||
cx.dispatch_action(ActivateItem(ix));
|
|
||||||
cx.propagate_event();
|
|
||||||
})
|
|
||||||
.on_click(MouseButton::Middle, {
|
|
||||||
let item = item.clone();
|
|
||||||
let pane = pane.clone();
|
|
||||||
move |_, cx: &mut EventContext| {
|
|
||||||
cx.dispatch_action(CloseItem {
|
|
||||||
item_id: item.id(),
|
|
||||||
pane: pane.clone(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.as_draggable(
|
|
||||||
DraggedItem {
|
|
||||||
item,
|
|
||||||
pane: pane.clone(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
|
||||||
|
|
||||||
let detail = detail.clone();
|
if !pane_active || !tab_active {
|
||||||
move |dragged_item, cx: &mut RenderContext<Workspace>| {
|
receiver = receiver.with_cursor_style(CursorStyle::PointingHand);
|
||||||
let tab_style = &theme.workspace.tab_bar.dragged_tab;
|
}
|
||||||
Self::render_tab(
|
|
||||||
&dragged_item.item,
|
receiver
|
||||||
dragged_item.pane.clone(),
|
.on_down(MouseButton::Left, move |_, cx| {
|
||||||
false,
|
cx.dispatch_action(ActivateItem(ix));
|
||||||
detail,
|
cx.propagate_event();
|
||||||
false,
|
})
|
||||||
&tab_style,
|
.on_click(MouseButton::Middle, {
|
||||||
cx,
|
let item = item.clone();
|
||||||
)
|
let pane = pane.clone();
|
||||||
|
move |_, cx: &mut EventContext| {
|
||||||
|
cx.dispatch_action(CloseItem {
|
||||||
|
item_id: item.id(),
|
||||||
|
pane: pane.clone(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
.as_draggable(
|
||||||
.boxed()
|
DraggedItem {
|
||||||
|
item,
|
||||||
|
pane: pane.clone(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
|
|
||||||
|
let detail = detail.clone();
|
||||||
|
move |dragged_item, cx: &mut RenderContext<Workspace>| {
|
||||||
|
let tab_style = &theme.workspace.tab_bar.dragged_tab;
|
||||||
|
Self::render_tab(
|
||||||
|
&dragged_item.item,
|
||||||
|
dragged_item.pane.clone(),
|
||||||
|
false,
|
||||||
|
detail,
|
||||||
|
false,
|
||||||
|
&tab_style,
|
||||||
|
cx,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.boxed()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ actions!(
|
||||||
ToggleRightSidebar,
|
ToggleRightSidebar,
|
||||||
NewTerminal,
|
NewTerminal,
|
||||||
NewSearch,
|
NewSearch,
|
||||||
|
Feedback,
|
||||||
ShowNotif,
|
ShowNotif,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -233,6 +234,7 @@ pub fn init(app_state: Arc<AppState>, cx: &mut MutableAppContext) {
|
||||||
workspace.toggle_sidebar(SidebarSide::Right, cx);
|
workspace.toggle_sidebar(SidebarSide::Right, cx);
|
||||||
});
|
});
|
||||||
cx.add_action(Workspace::activate_pane_at_index);
|
cx.add_action(Workspace::activate_pane_at_index);
|
||||||
|
|
||||||
cx.add_action(Workspace::split_pane_with_item);
|
cx.add_action(Workspace::split_pane_with_item);
|
||||||
cx.add_action(Workspace::split_pane_with_project_entry);
|
cx.add_action(Workspace::split_pane_with_project_entry);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ description = "The fast, collaborative code editor."
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "zed"
|
name = "zed"
|
||||||
version = "0.71.0"
|
version = "0.71.0"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "zed"
|
name = "zed"
|
||||||
|
@ -29,8 +30,8 @@ client = { path = "../client" }
|
||||||
clock = { path = "../clock" }
|
clock = { path = "../clock" }
|
||||||
diagnostics = { path = "../diagnostics" }
|
diagnostics = { path = "../diagnostics" }
|
||||||
editor = { path = "../editor" }
|
editor = { path = "../editor" }
|
||||||
|
feedback = { path = "../feedback" }
|
||||||
file_finder = { path = "../file_finder" }
|
file_finder = { path = "../file_finder" }
|
||||||
human_bytes = "0.4.1"
|
|
||||||
search = { path = "../search" }
|
search = { path = "../search" }
|
||||||
fs = { path = "../fs" }
|
fs = { path = "../fs" }
|
||||||
fsevent = { path = "../fsevent" }
|
fsevent = { path = "../fsevent" }
|
||||||
|
@ -49,7 +50,6 @@ recent_projects = { path = "../recent_projects" }
|
||||||
rpc = { path = "../rpc" }
|
rpc = { path = "../rpc" }
|
||||||
settings = { path = "../settings" }
|
settings = { path = "../settings" }
|
||||||
sum_tree = { path = "../sum_tree" }
|
sum_tree = { path = "../sum_tree" }
|
||||||
sysinfo = "0.27.1"
|
|
||||||
text = { path = "../text" }
|
text = { path = "../text" }
|
||||||
terminal_view = { path = "../terminal_view" }
|
terminal_view = { path = "../terminal_view" }
|
||||||
theme = { path = "../theme" }
|
theme = { path = "../theme" }
|
||||||
|
@ -110,7 +110,6 @@ tree-sitter-html = "0.19.0"
|
||||||
tree-sitter-scheme = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "af0fd1fa452cb2562dc7b5c8a8c55551c39273b9"}
|
tree-sitter-scheme = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "af0fd1fa452cb2562dc7b5c8a8c55551c39273b9"}
|
||||||
tree-sitter-racket = { git = "https://github.com/zed-industries/tree-sitter-racket", rev = "eb010cf2c674c6fd9a6316a84e28ef90190fe51a"}
|
tree-sitter-racket = { git = "https://github.com/zed-industries/tree-sitter-racket", rev = "eb010cf2c674c6fd9a6316a84e28ef90190fe51a"}
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
urlencoding = "2.1.2"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
call = { path = "../call", features = ["test-support"] }
|
call = { path = "../call", features = ["test-support"] }
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
use crate::OpenBrowser;
|
|
||||||
use gpui::{
|
|
||||||
elements::{MouseEventHandler, Text},
|
|
||||||
platform::CursorStyle,
|
|
||||||
Element, Entity, MouseButton, RenderContext, View,
|
|
||||||
};
|
|
||||||
use settings::Settings;
|
|
||||||
use workspace::{item::ItemHandle, StatusItemView};
|
|
||||||
|
|
||||||
pub const NEW_ISSUE_URL: &str = "https://github.com/zed-industries/feedback/issues/new/choose";
|
|
||||||
|
|
||||||
pub struct FeedbackLink;
|
|
||||||
|
|
||||||
impl Entity for FeedbackLink {
|
|
||||||
type Event = ();
|
|
||||||
}
|
|
||||||
|
|
||||||
impl View for FeedbackLink {
|
|
||||||
fn ui_name() -> &'static str {
|
|
||||||
"FeedbackLink"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut RenderContext<'_, Self>) -> gpui::ElementBox {
|
|
||||||
MouseEventHandler::<Self>::new(0, cx, |state, cx| {
|
|
||||||
let theme = &cx.global::<Settings>().theme;
|
|
||||||
let theme = &theme.workspace.status_bar.feedback;
|
|
||||||
Text::new(
|
|
||||||
"Give Feedback".to_string(),
|
|
||||||
theme.style_for(state, false).clone(),
|
|
||||||
)
|
|
||||||
.boxed()
|
|
||||||
})
|
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
|
||||||
.on_click(MouseButton::Left, |_, cx| {
|
|
||||||
cx.dispatch_action(OpenBrowser {
|
|
||||||
url: NEW_ISSUE_URL.into(),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.boxed()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl StatusItemView for FeedbackLink {
|
|
||||||
fn set_active_pane_item(
|
|
||||||
&mut self,
|
|
||||||
_: Option<&dyn ItemHandle>,
|
|
||||||
_: &mut gpui::ViewContext<Self>,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,6 +14,7 @@ use client::{
|
||||||
http::{self, HttpClient},
|
http::{self, HttpClient},
|
||||||
UserStore, ZED_SECRET_CLIENT_TOKEN,
|
UserStore, ZED_SECRET_CLIENT_TOKEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::{
|
use futures::{
|
||||||
channel::{mpsc, oneshot},
|
channel::{mpsc, oneshot},
|
||||||
FutureExt, SinkExt, StreamExt,
|
FutureExt, SinkExt, StreamExt,
|
||||||
|
@ -125,11 +126,14 @@ fn main() {
|
||||||
|
|
||||||
watch_keymap_file(keymap_file, cx);
|
watch_keymap_file(keymap_file, cx);
|
||||||
|
|
||||||
|
cx.set_global(client.clone());
|
||||||
|
|
||||||
context_menu::init(cx);
|
context_menu::init(cx);
|
||||||
project::Project::init(&client);
|
project::Project::init(&client);
|
||||||
client::init(client.clone(), cx);
|
client::init(client.clone(), cx);
|
||||||
command_palette::init(cx);
|
command_palette::init(cx);
|
||||||
editor::init(cx);
|
editor::init(cx);
|
||||||
|
feedback::init(cx);
|
||||||
go_to_line::init(cx);
|
go_to_line::init(cx);
|
||||||
file_finder::init(cx);
|
file_finder::init(cx);
|
||||||
outline::init(cx);
|
outline::init(cx);
|
||||||
|
|
|
@ -340,15 +340,15 @@ pub fn menus() -> Vec<Menu<'static>> {
|
||||||
MenuItem::Separator,
|
MenuItem::Separator,
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
name: "Copy System Specs Into Clipboard",
|
name: "Copy System Specs Into Clipboard",
|
||||||
action: Box::new(crate::CopySystemSpecsIntoClipboard),
|
action: Box::new(feedback::CopySystemSpecsIntoClipboard),
|
||||||
},
|
},
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
name: "File Bug Report",
|
name: "File Bug Report",
|
||||||
action: Box::new(crate::FileBugReport),
|
action: Box::new(feedback::FileBugReport),
|
||||||
},
|
},
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
name: "Request Feature",
|
name: "Request Feature",
|
||||||
action: Box::new(crate::RequestFeature),
|
action: Box::new(feedback::RequestFeature),
|
||||||
},
|
},
|
||||||
MenuItem::Separator,
|
MenuItem::Separator,
|
||||||
MenuItem::Action {
|
MenuItem::Action {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
mod feedback;
|
|
||||||
pub mod languages;
|
pub mod languages;
|
||||||
pub mod menus;
|
pub mod menus;
|
||||||
pub mod system_specs;
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use assets::Assets;
|
use assets::Assets;
|
||||||
use breadcrumbs::Breadcrumbs;
|
use breadcrumbs::Breadcrumbs;
|
||||||
|
@ -23,8 +20,7 @@ use gpui::{
|
||||||
},
|
},
|
||||||
impl_actions,
|
impl_actions,
|
||||||
platform::{WindowBounds, WindowOptions},
|
platform::{WindowBounds, WindowOptions},
|
||||||
AssetSource, AsyncAppContext, ClipboardItem, PromptLevel, TitlebarOptions, ViewContext,
|
AssetSource, AsyncAppContext, PromptLevel, TitlebarOptions, ViewContext, WindowKind,
|
||||||
WindowKind,
|
|
||||||
};
|
};
|
||||||
use language::Rope;
|
use language::Rope;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -35,14 +31,13 @@ use search::{BufferSearchBar, ProjectSearchBar};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::to_string_pretty;
|
use serde_json::to_string_pretty;
|
||||||
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
|
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
|
||||||
use std::{env, path::Path, str, sync::Arc};
|
use std::{borrow::Cow, env, path::Path, str, sync::Arc};
|
||||||
use system_specs::SystemSpecs;
|
|
||||||
use util::{channel::ReleaseChannel, paths, ResultExt};
|
use util::{channel::ReleaseChannel, paths, ResultExt};
|
||||||
pub use workspace;
|
pub use workspace;
|
||||||
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
||||||
|
|
||||||
#[derive(Deserialize, Clone, PartialEq)]
|
#[derive(Deserialize, Clone, PartialEq)]
|
||||||
struct OpenBrowser {
|
pub struct OpenBrowser {
|
||||||
url: Arc<str>,
|
url: Arc<str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +57,7 @@ actions!(
|
||||||
DebugElements,
|
DebugElements,
|
||||||
OpenSettings,
|
OpenSettings,
|
||||||
OpenLog,
|
OpenLog,
|
||||||
|
OpenLicenses,
|
||||||
OpenTelemetryLog,
|
OpenTelemetryLog,
|
||||||
OpenKeymap,
|
OpenKeymap,
|
||||||
OpenDefaultSettings,
|
OpenDefaultSettings,
|
||||||
|
@ -71,9 +67,6 @@ actions!(
|
||||||
ResetBufferFontSize,
|
ResetBufferFontSize,
|
||||||
InstallCommandLineInterface,
|
InstallCommandLineInterface,
|
||||||
ResetDatabase,
|
ResetDatabase,
|
||||||
CopySystemSpecsIntoClipboard,
|
|
||||||
RequestFeature,
|
|
||||||
FileBugReport
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -184,6 +177,19 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
open_log_file(workspace, app_state.clone(), cx);
|
open_log_file(workspace, app_state.clone(), cx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
cx.add_action({
|
||||||
|
let app_state = app_state.clone();
|
||||||
|
move |workspace: &mut Workspace, _: &OpenLicenses, cx: &mut ViewContext<Workspace>| {
|
||||||
|
open_bundled_file(
|
||||||
|
workspace,
|
||||||
|
app_state.clone(),
|
||||||
|
"licenses.md",
|
||||||
|
"Open Source License Attribution",
|
||||||
|
"Markdown",
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
cx.add_action({
|
cx.add_action({
|
||||||
let app_state = app_state.clone();
|
let app_state = app_state.clone();
|
||||||
move |workspace: &mut Workspace, _: &OpenTelemetryLog, cx: &mut ViewContext<Workspace>| {
|
move |workspace: &mut Workspace, _: &OpenTelemetryLog, cx: &mut ViewContext<Workspace>| {
|
||||||
|
@ -199,11 +205,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
cx.add_action({
|
cx.add_action({
|
||||||
let app_state = app_state.clone();
|
let app_state = app_state.clone();
|
||||||
move |workspace: &mut Workspace, _: &OpenDefaultKeymap, cx: &mut ViewContext<Workspace>| {
|
move |workspace: &mut Workspace, _: &OpenDefaultKeymap, cx: &mut ViewContext<Workspace>| {
|
||||||
open_bundled_config_file(
|
open_bundled_file(
|
||||||
workspace,
|
workspace,
|
||||||
app_state.clone(),
|
app_state.clone(),
|
||||||
"keymaps/default.json",
|
"keymaps/default.json",
|
||||||
"Default Key Bindings",
|
"Default Key Bindings",
|
||||||
|
"JSON",
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -213,11 +220,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
move |workspace: &mut Workspace,
|
move |workspace: &mut Workspace,
|
||||||
_: &OpenDefaultSettings,
|
_: &OpenDefaultSettings,
|
||||||
cx: &mut ViewContext<Workspace>| {
|
cx: &mut ViewContext<Workspace>| {
|
||||||
open_bundled_config_file(
|
open_bundled_file(
|
||||||
workspace,
|
workspace,
|
||||||
app_state.clone(),
|
app_state.clone(),
|
||||||
"settings/default.json",
|
"settings/default.json",
|
||||||
"Default Settings",
|
"Default Settings",
|
||||||
|
"JSON",
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -256,41 +264,6 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
cx.add_action(
|
|
||||||
|_: &mut Workspace, _: &CopySystemSpecsIntoClipboard, cx: &mut ViewContext<Workspace>| {
|
|
||||||
let system_specs = SystemSpecs::new(cx).to_string();
|
|
||||||
let item = ClipboardItem::new(system_specs.clone());
|
|
||||||
cx.prompt(
|
|
||||||
gpui::PromptLevel::Info,
|
|
||||||
&format!("Copied into clipboard:\n\n{system_specs}"),
|
|
||||||
&["OK"],
|
|
||||||
);
|
|
||||||
cx.write_to_clipboard(item);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
cx.add_action(
|
|
||||||
|_: &mut Workspace, _: &RequestFeature, cx: &mut ViewContext<Workspace>| {
|
|
||||||
let url = "https://github.com/zed-industries/feedback/issues/new?assignees=&labels=enhancement%2Ctriage&template=0_feature_request.yml";
|
|
||||||
cx.dispatch_action(OpenBrowser {
|
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
cx.add_action(
|
|
||||||
|_: &mut Workspace, _: &FileBugReport, cx: &mut ViewContext<Workspace>| {
|
|
||||||
let system_specs_text = SystemSpecs::new(cx).to_string();
|
|
||||||
let url = format!(
|
|
||||||
"https://github.com/zed-industries/feedback/issues/new?assignees=&labels=defect%2Ctriage&template=2_bug_report.yml&environment={}",
|
|
||||||
urlencoding::encode(&system_specs_text)
|
|
||||||
);
|
|
||||||
cx.dispatch_action(OpenBrowser {
|
|
||||||
url: url.into(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
activity_indicator::init(cx);
|
activity_indicator::init(cx);
|
||||||
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
|
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
|
||||||
settings::KeymapFileContent::load_defaults(cx);
|
settings::KeymapFileContent::load_defaults(cx);
|
||||||
|
@ -375,12 +348,12 @@ pub fn initialize_workspace(
|
||||||
let activity_indicator =
|
let activity_indicator =
|
||||||
activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx);
|
activity_indicator::ActivityIndicator::new(workspace, app_state.languages.clone(), cx);
|
||||||
let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
|
let cursor_position = cx.add_view(|_| editor::items::CursorPosition::new());
|
||||||
let feedback_link = cx.add_view(|_| feedback::FeedbackLink);
|
let feedback_button = cx.add_view(|_| feedback::feedback_editor::FeedbackButton {});
|
||||||
workspace.status_bar().update(cx, |status_bar, cx| {
|
workspace.status_bar().update(cx, |status_bar, cx| {
|
||||||
status_bar.add_left_item(diagnostic_summary, cx);
|
status_bar.add_left_item(diagnostic_summary, cx);
|
||||||
status_bar.add_left_item(activity_indicator, cx);
|
status_bar.add_left_item(activity_indicator, cx);
|
||||||
status_bar.add_right_item(cursor_position, cx);
|
status_bar.add_right_item(cursor_position, cx);
|
||||||
status_bar.add_right_item(feedback_link, cx);
|
status_bar.add_right_item(feedback_button, cx);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto_update::notify_of_any_new_update(cx.weak_handle(), cx);
|
auto_update::notify_of_any_new_update(cx.weak_handle(), cx);
|
||||||
|
@ -660,21 +633,24 @@ fn open_telemetry_log_file(
|
||||||
}).detach();
|
}).detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_bundled_config_file(
|
fn open_bundled_file(
|
||||||
workspace: &mut Workspace,
|
workspace: &mut Workspace,
|
||||||
app_state: Arc<AppState>,
|
app_state: Arc<AppState>,
|
||||||
asset_path: &'static str,
|
asset_path: &'static str,
|
||||||
title: &'static str,
|
title: &'static str,
|
||||||
|
language: &'static str,
|
||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) {
|
) {
|
||||||
workspace
|
workspace
|
||||||
.with_local_workspace(&app_state, cx, |workspace, cx| {
|
.with_local_workspace(&app_state, cx, |workspace, cx| {
|
||||||
let project = workspace.project().clone();
|
let project = workspace.project().clone();
|
||||||
let buffer = project.update(cx, |project, cx| {
|
let buffer = project.update(cx, |project, cx| {
|
||||||
let text = Assets::get(asset_path).unwrap().data;
|
let text = Assets::get(asset_path)
|
||||||
|
.map(|f| f.data)
|
||||||
|
.unwrap_or_else(|| Cow::Borrowed(b"File not found"));
|
||||||
let text = str::from_utf8(text.as_ref()).unwrap();
|
let text = str::from_utf8(text.as_ref()).unwrap();
|
||||||
project
|
project
|
||||||
.create_buffer(text, project.languages().language_for_name("JSON"), cx)
|
.create_buffer(text, project.languages().language_for_name(language), cx)
|
||||||
.expect("creating buffers on a local workspace always succeeds")
|
.expect("creating buffers on a local workspace always succeeds")
|
||||||
});
|
});
|
||||||
let buffer =
|
let buffer =
|
||||||
|
|
15
script/generate-licenses
Executable file
15
script/generate-licenses
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
[[ "$(cargo about --version)" == "cargo-about 0.5.2" ]] || cargo install cargo-about --locked --git https://github.com/zed-industries/cargo-about --branch error-code-on-warn
|
||||||
|
|
||||||
|
cargo about generate --fail-on-missing-license -o assets/licenses.md -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md
|
||||||
|
|
||||||
|
# cargo about automatically html-escapes all output, so we need to undo it here:
|
||||||
|
sed -i '' 's/"/"/g' assets/licenses.md
|
||||||
|
sed -i '' 's/'/'\''/g' assets/licenses.md # `'\''` ends the string, appends a single quote, and re-opens the string
|
||||||
|
sed -i '' 's/=/=/g' assets/licenses.md
|
||||||
|
sed -i '' 's/`/`/g' assets/licenses.md
|
||||||
|
sed -i '' 's/</</g' assets/licenses.md
|
||||||
|
sed -i '' 's/>/>/g' assets/licenses.md
|
27
script/licenses/template.hbs.md
Normal file
27
script/licenses/template.hbs.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Third Party Licenses
|
||||||
|
|
||||||
|
This page lists the licenses of the projects used in Zed.
|
||||||
|
|
||||||
|
## Overview of licenses:
|
||||||
|
|
||||||
|
{{#each overview}}
|
||||||
|
* {{name}} ({{count}})
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
## All license texts:
|
||||||
|
|
||||||
|
{{#each licenses}}
|
||||||
|
|
||||||
|
### {{name}}
|
||||||
|
|
||||||
|
#### Used by:
|
||||||
|
|
||||||
|
{{#each used_by}}
|
||||||
|
* [{{crate.name}} {{crate.version}}]({{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}})
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{text}}
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
{{/each}}
|
37
script/licenses/zed-licenses.toml
Normal file
37
script/licenses/zed-licenses.toml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
no-clearly-defined = true
|
||||||
|
private = { ignore = true }
|
||||||
|
accepted = [
|
||||||
|
"Apache-2.0",
|
||||||
|
"MIT",
|
||||||
|
"Apache-2.0 WITH LLVM-exception",
|
||||||
|
"MPL-2.0",
|
||||||
|
"BSD-3-Clause",
|
||||||
|
"BSD-2-Clause",
|
||||||
|
"ISC",
|
||||||
|
"CC0-1.0",
|
||||||
|
"Unicode-DFS-2016",
|
||||||
|
"OpenSSL",
|
||||||
|
"Zlib",
|
||||||
|
]
|
||||||
|
workarounds = [
|
||||||
|
"ring",
|
||||||
|
"wasmtime",
|
||||||
|
]
|
||||||
|
|
||||||
|
[procinfo.clarify]
|
||||||
|
license = "MIT"
|
||||||
|
[[procinfo.clarify.git]]
|
||||||
|
path = 'LICENSE.md'
|
||||||
|
checksum = '37db33bbbd7348969eda397b89a16f252d56c1ca7481b6ccaf56ccdcbab5dcca'
|
||||||
|
|
||||||
|
[webpki.clarify]
|
||||||
|
license = "ISC" # It actually says 'ISC-style' but I don't know the SPDX expression for that.
|
||||||
|
[[webpki.clarify.files]]
|
||||||
|
path = 'LICENSE'
|
||||||
|
checksum = '5b698ca13897be3afdb7174256fa1574f8c6892b8bea1a66dd6469d3fe27885a'
|
||||||
|
|
||||||
|
[fuchsia-cprng.clarify]
|
||||||
|
license = "BSD-3-Clause"
|
||||||
|
[[fuchsia-cprng.clarify.files]]
|
||||||
|
path = 'LICENSE'
|
||||||
|
checksum = '03b114f53e6587a398931762ee11e2395bfdba252a329940e2c8c9e81813845b'
|
|
@ -11,15 +11,15 @@ const license = {
|
||||||
|
|
||||||
export const light = createColorScheme(`${name}`, true, {
|
export const light = createColorScheme(`${name}`, true, {
|
||||||
neutral: chroma.scale([
|
neutral: chroma.scale([
|
||||||
"#090a0b",
|
"#090a0b",
|
||||||
"#202227",
|
"#202227",
|
||||||
"#383a42",
|
"#383a42",
|
||||||
"#696c77",
|
"#696c77",
|
||||||
"#a0a1a7",
|
"#a0a1a7",
|
||||||
"#e5e5e6",
|
"#e5e5e6",
|
||||||
"#f0f0f1",
|
"#f0f0f1",
|
||||||
"#fafafa",
|
"#fafafa",
|
||||||
])
|
])
|
||||||
.domain([0.05, 0.22, 0.25, 0.45, 0.62, 0.8, 0.9, 1]),
|
.domain([0.05, 0.22, 0.25, 0.45, 0.62, 0.8, 0.9, 1]),
|
||||||
|
|
||||||
red: colorRamp(chroma("#ca1243")),
|
red: colorRamp(chroma("#ca1243")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue