mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-18 18:08:07 +03:00
Move feedback items into a feedback crate
This commit is contained in:
parent
a73e264c3d
commit
c1e61b479c
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -2022,6 +2022,26 @@ dependencies = [
|
|||||||
"instant",
|
"instant",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "feedback"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"client",
|
||||||
|
"editor",
|
||||||
|
"futures 0.3.25",
|
||||||
|
"gpui",
|
||||||
|
"human_bytes",
|
||||||
|
"isahc",
|
||||||
|
"lazy_static",
|
||||||
|
"serde",
|
||||||
|
"settings",
|
||||||
|
"sysinfo",
|
||||||
|
"urlencoding",
|
||||||
|
"util",
|
||||||
|
"workspace",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "file-per-thread-logger"
|
name = "file-per-thread-logger"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@ -6239,9 +6259,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",
|
||||||
@ -8212,6 +8232,7 @@ dependencies = [
|
|||||||
"easy-parallel",
|
"easy-parallel",
|
||||||
"editor",
|
"editor",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"feedback",
|
||||||
"file_finder",
|
"file_finder",
|
||||||
"fs",
|
"fs",
|
||||||
"fsevent",
|
"fsevent",
|
||||||
@ -8219,7 +8240,6 @@ dependencies = [
|
|||||||
"fuzzy",
|
"fuzzy",
|
||||||
"go_to_line",
|
"go_to_line",
|
||||||
"gpui",
|
"gpui",
|
||||||
"human_bytes",
|
|
||||||
"ignore",
|
"ignore",
|
||||||
"image",
|
"image",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
@ -8253,7 +8273,6 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
"smol",
|
"smol",
|
||||||
"sum_tree",
|
"sum_tree",
|
||||||
"sysinfo",
|
|
||||||
"tempdir",
|
"tempdir",
|
||||||
"terminal_view",
|
"terminal_view",
|
||||||
"text",
|
"text",
|
||||||
@ -8282,7 +8301,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",
|
||||||
|
26
crates/feedback/Cargo.toml
Normal file
26
crates/feedback/Cargo.toml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
[package]
|
||||||
|
name = "feedback"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/feedback.rs"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
test-support = []
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.38"
|
||||||
|
client = { path = "../client" }
|
||||||
|
editor = { path = "../editor" }
|
||||||
|
futures = "0.3"
|
||||||
|
gpui = { path = "../gpui" }
|
||||||
|
human_bytes = "0.4.1"
|
||||||
|
isahc = "1.7"
|
||||||
|
lazy_static = "1.4.0"
|
||||||
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
|
settings = { path = "../settings" }
|
||||||
|
sysinfo = "0.27.1"
|
||||||
|
urlencoding = "2.1.2"
|
||||||
|
util = { path = "../util" }
|
||||||
|
workspace = { path = "../workspace" }
|
62
crates/feedback/src/feedback.rs
Normal file
62
crates/feedback/src/feedback.rs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
pub mod feedback_popover;
|
||||||
|
mod system_specs;
|
||||||
|
use gpui::{actions, impl_actions, ClipboardItem, ViewContext};
|
||||||
|
use serde::Deserialize;
|
||||||
|
use system_specs::SystemSpecs;
|
||||||
|
use workspace::Workspace;
|
||||||
|
|
||||||
|
// TODO FEEDBACK: This open brownser code is duplicated from the zed crate, where should we refactor it to?
|
||||||
|
#[derive(Deserialize, Clone, PartialEq)]
|
||||||
|
struct OpenBrowser {
|
||||||
|
url: Arc<str>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_actions!(zed, [OpenBrowser]);
|
||||||
|
|
||||||
|
actions!(
|
||||||
|
zed,
|
||||||
|
[CopySystemSpecsIntoClipboard, FileBugReport, RequestFeature,]
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn init(cx: &mut gpui::MutableAppContext) {
|
||||||
|
feedback_popover::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(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
@ -230,6 +230,12 @@ impl View for FeedbackPopover {
|
|||||||
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
enum SubmitFeedback {}
|
enum SubmitFeedback {}
|
||||||
|
|
||||||
|
// I'd like to just define:
|
||||||
|
|
||||||
|
// 1. Overall popover width x height dimensions (done)
|
||||||
|
// 2. Submit Feedback button height dimensions
|
||||||
|
// 3. Allow editor to dynamically fill in the remaining space
|
||||||
|
|
||||||
let theme = cx.global::<Settings>().theme.clone();
|
let theme = cx.global::<Settings>().theme.clone();
|
||||||
let submit_feedback_text_button_height = 20.0;
|
let submit_feedback_text_button_height = 20.0;
|
||||||
|
|
@ -29,8 +29,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 +49,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 +109,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"] }
|
||||||
|
@ -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,
|
||||||
@ -41,7 +42,7 @@ use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt};
|
|||||||
use workspace::{
|
use workspace::{
|
||||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
||||||
};
|
};
|
||||||
use zed::{self, build_window_options, feedback_popover, initialize_workspace, languages, menus};
|
use zed::{self, build_window_options, initialize_workspace, languages, menus};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http = http::client();
|
let http = http::client();
|
||||||
@ -110,12 +111,12 @@ fn main() {
|
|||||||
|
|
||||||
cx.set_global(client.clone());
|
cx.set_global(client.clone());
|
||||||
|
|
||||||
feedback_popover::init(cx);
|
|
||||||
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 @@
|
|||||||
pub mod feedback_popover;
|
|
||||||
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;
|
||||||
@ -22,7 +19,7 @@ use gpui::{
|
|||||||
},
|
},
|
||||||
impl_actions,
|
impl_actions,
|
||||||
platform::{WindowBounds, WindowOptions},
|
platform::{WindowBounds, WindowOptions},
|
||||||
AssetSource, AsyncAppContext, ClipboardItem, TitlebarOptions, ViewContext, WindowKind,
|
AssetSource, AsyncAppContext, TitlebarOptions, ViewContext, WindowKind,
|
||||||
};
|
};
|
||||||
use language::Rope;
|
use language::Rope;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
@ -34,7 +31,6 @@ 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::{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};
|
||||||
@ -69,9 +65,6 @@ actions!(
|
|||||||
ResetBufferFontSize,
|
ResetBufferFontSize,
|
||||||
InstallCommandLineInterface,
|
InstallCommandLineInterface,
|
||||||
ResetDatabase,
|
ResetDatabase,
|
||||||
CopySystemSpecsIntoClipboard,
|
|
||||||
RequestFeature,
|
|
||||||
FileBugReport
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -250,41 +243,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);
|
||||||
@ -369,12 +327,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_popover::FeedbackButton::new());
|
let feedback_button = cx.add_view(|_| feedback::feedback_popover::FeedbackButton::new());
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user