Compare commits

...

23 Commits

Author SHA1 Message Date
Mikayla Maki
8d0b6a3e58 v0.68.x preview 2023-01-04 11:45:00 -08:00
Julia
1e18480808 Merge pull request #2005 from zed-industries/tsserver-include-completion-detail
Include Typescript completion item `detail` field in completion label
2023-01-03 16:44:10 -05:00
Julia
93a634991b Include Typescript completion item detail field in completion label 2023-01-03 16:37:35 -05:00
Julia
d0ce7b3516 Merge pull request #2003 from zed-industries/correct-ra-name-key-default-settings
Correct default settings' name key for RA in init options example
2023-01-03 13:51:03 -05:00
Julia
b94c265240 Correct default settings' name key for RA in init options example 2023-01-03 13:50:08 -05:00
Julia
6b62ce2aaa Merge pull request #2001 from zed-industries/dissmis-search-button
Add dismiss buffer search button & fix some faulty icon button styling
2023-01-02 11:21:16 -05:00
Julia
2b1118f597 Add dismiss buffer search button & fix some faulty icon button styling
Co-Authored-By: Nate Butler <nate@zed.dev>
2023-01-01 23:50:46 -05:00
Mikayla Maki
eeb21af841 Merge pull request #2000 from zed-industries/fix-line-seperator
Add other line seperators to regex normalization
2022-12-30 18:24:36 -08:00
Mikayla Maki
a5bccecd48 Add other line seperators to regex normalization 2022-12-30 18:18:02 -08:00
Joseph T. Lyons
0f818f2458 Merge pull request #1996 from zed-industries/add-close-clean-items-command
Add close clean items command
2022-12-29 14:12:04 -05:00
Joseph T. Lyons
7187cc8a4c Merge pull request #1994 from zed-industries/add-close-all-items-command
Add close all items command
2022-12-29 14:11:44 -05:00
Joseph Lyons
2bc36600d4 Rename variable 2022-12-29 13:43:56 -05:00
Joseph Lyons
60f29410ca Add close clean items command 2022-12-29 13:28:52 -05:00
Joseph Lyons
ca3c4566dd Add close all items command 2022-12-29 01:43:49 -05:00
Joseph T. Lyons
b6337f59fd Merge pull request #1992 from zed-industries/add-home-and-end-key-support
Add home and end key support
2022-12-26 00:34:37 -05:00
Joseph Lyons
21a0df406f Add home and end key support 2022-12-26 00:24:26 -05:00
Joseph T. Lyons
04e053a216 Merge pull request #1991 from zed-industries/add-actions-for-requesting-features-and-filing-bug-reports
Add actions for requesting features and filing bug reports
2022-12-22 23:17:44 -05:00
Joseph Lyons
41bff3947c Add actions for requesting features and filing bug reports 2022-12-22 23:04:33 -05:00
Joseph T. Lyons
46152c6249 Merge pull request #1990 from zed-industries/add-memory-to-system-specs
Add memory to system specs
2022-12-22 18:16:50 -05:00
Joseph Lyons
f65fda2fa4 Add memory to system specs 2022-12-22 18:10:49 -05:00
Joseph T. Lyons
96ac650465 Merge pull request #1989 from zed-industries/add-command-to-copy-system-information-to-the-clipboard
add command to copy system information to the clipboard
2022-12-22 14:31:23 -05:00
Joseph Lyons
ea16082a42 Factored data into a SystemSpecs struct
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-12-22 14:27:32 -05:00
Joseph Lyons
eeb5b03d63 add command to copy system information to the clipboard 2022-12-22 03:43:04 -05:00
20 changed files with 363 additions and 108 deletions

41
Cargo.lock generated
View File

@@ -2757,6 +2757,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "human_bytes"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39b528196c838e8b3da8b665e08c30958a6f2ede91d79f2ffcd0d4664b9c64eb"
[[package]]
name = "humantime"
version = "2.1.0"
@@ -3755,6 +3761,15 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "ntapi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
@@ -4424,7 +4439,7 @@ source = "git+https://github.com/zed-industries/wezterm?rev=5cd757e5f2eb039ed0c6
dependencies = [
"libc",
"log",
"ntapi",
"ntapi 0.3.7",
"winapi 0.3.9",
]
@@ -6219,6 +6234,21 @@ dependencies = [
"libc",
]
[[package]]
name = "sysinfo"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccb297c0afb439440834b4bcf02c5c9da8ec2e808e70f36b0d8e815ff403bd24"
dependencies = [
"cfg-if 1.0.0",
"core-foundation-sys",
"libc",
"ntapi 0.4.0",
"once_cell",
"rayon",
"winapi 0.3.9",
]
[[package]]
name = "system-interface"
version = "0.20.0"
@@ -7201,6 +7231,12 @@ dependencies = [
"serde",
]
[[package]]
name = "urlencoding"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"
[[package]]
name = "usvg"
version = "0.14.1"
@@ -8180,6 +8216,7 @@ dependencies = [
"fuzzy",
"go_to_line",
"gpui",
"human_bytes",
"ignore",
"image",
"indexmap",
@@ -8213,6 +8250,7 @@ dependencies = [
"smallvec",
"smol",
"sum_tree",
"sysinfo",
"tempdir",
"terminal_view",
"text",
@@ -8241,6 +8279,7 @@ dependencies = [
"tree-sitter-typescript",
"unindent",
"url",
"urlencoding",
"util",
"vim",
"workspace",

View File

@@ -20,8 +20,10 @@
"alt-cmd-left": "pane::ActivatePrevItem",
"alt-cmd-right": "pane::ActivateNextItem",
"cmd-w": "pane::CloseActiveItem",
"cmd-shift-w": "workspace::CloseWindow",
"alt-cmd-t": "pane::CloseInactiveItems",
"cmd-k u": "pane::CloseCleanItems",
"cmd-k cmd-w": "pane::CloseAllItems",
"cmd-shift-w": "workspace::CloseWindow",
"cmd-s": "workspace::Save",
"cmd-shift-s": "workspace::SaveAs",
"cmd-=": "zed::IncreaseBufferFontSize",
@@ -67,9 +69,11 @@
"up": "editor::MoveUp",
"pageup": "editor::PageUp",
"shift-pageup": "editor::MovePageUp",
"home": "editor::MoveToBeginningOfLine",
"down": "editor::MoveDown",
"pagedown": "editor::PageDown",
"shift-pagedown": "editor::MovePageDown",
"end": "editor::MoveToEndOfLine",
"left": "editor::MoveLeft",
"right": "editor::MoveRight",
"ctrl-p": "editor::MoveUp",
@@ -110,6 +114,12 @@
"stop_at_soft_wraps": true
}
],
"shift-home": [
"editor::SelectToBeginningOfLine",
{
"stop_at_soft_wraps": true
}
],
"ctrl-shift-a": [
"editor::SelectToBeginningOfLine",
{
@@ -122,6 +132,12 @@
"stop_at_soft_wraps": true
}
],
"shift-end": [
"editor::SelectToEndOfLine",
{
"stop_at_soft_wraps": true
}
],
"ctrl-shift-e": [
"editor::SelectToEndOfLine",
{

View File

@@ -221,7 +221,7 @@
// rust-analyzer
// typescript-language-server
// vscode-json-languageserver
// "rust_analyzer": {
// "rust-analyzer": {
// //These initialization options are merged into Zed's defaults
// "initialization_options": {
// "checkOnSave": {

View File

@@ -35,7 +35,7 @@ use repository::FakeGitRepositoryState;
use std::sync::Weak;
lazy_static! {
static ref CARRIAGE_RETURNS_REGEX: Regex = Regex::new("\r\n|\r").unwrap();
static ref LINE_SEPERATORS_REGEX: Regex = Regex::new("\r\n|\r|\u{2028}|\u{2029}").unwrap();
}
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -80,13 +80,13 @@ impl LineEnding {
}
pub fn normalize(text: &mut String) {
if let Cow::Owned(replaced) = CARRIAGE_RETURNS_REGEX.replace_all(text, "\n") {
if let Cow::Owned(replaced) = LINE_SEPERATORS_REGEX.replace_all(text, "\n") {
*text = replaced;
}
}
pub fn normalize_arc(text: Arc<str>) -> Arc<str> {
if let Cow::Owned(replaced) = CARRIAGE_RETURNS_REGEX.replace_all(&text, "\n") {
if let Cow::Owned(replaced) = LINE_SEPERATORS_REGEX.replace_all(&text, "\n") {
replaced.into()
} else {
text

View File

@@ -4038,7 +4038,7 @@ pub struct RenderContext<'a, T: View> {
pub refreshing: bool,
}
#[derive(Clone, Default)]
#[derive(Debug, Clone, Default)]
pub struct MouseState {
hovered: bool,
clicked: Option<MouseButton>,

View File

@@ -47,6 +47,8 @@ pub fn key_to_native(key: &str) -> Cow<str> {
"right" => NSRightArrowFunctionKey,
"pageup" => NSPageUpFunctionKey,
"pagedown" => NSPageDownFunctionKey,
"home" => NSHomeFunctionKey,
"end" => NSEndFunctionKey,
"delete" => NSDeleteFunctionKey,
"f1" => NSF1FunctionKey,
"f2" => NSF2FunctionKey,
@@ -258,6 +260,8 @@ unsafe fn parse_keystroke(native_event: id) -> Keystroke {
Some(NSRightArrowFunctionKey) => "right".to_string(),
Some(NSPageUpFunctionKey) => "pageup".to_string(),
Some(NSPageDownFunctionKey) => "pagedown".to_string(),
Some(NSHomeFunctionKey) => "home".to_string(),
Some(NSEndFunctionKey) => "end".to_string(),
Some(NSDeleteFunctionKey) => "delete".to_string(),
Some(NSF1FunctionKey) => "f1".to_string(),
Some(NSF2FunctionKey) => "f2".to_string(),

View File

@@ -106,73 +106,79 @@ impl View for BufferSearchBar {
.with_child(
Flex::row()
.with_child(
ChildView::new(&self.query_editor, cx)
.aligned()
.left()
.flex(1., true)
.boxed(),
)
.with_children(self.active_searchable_item.as_ref().and_then(
|searchable_item| {
let matches = self
.seachable_items_with_matches
.get(&searchable_item.downgrade())?;
let message = if let Some(match_ix) = self.active_match_index {
format!("{}/{}", match_ix + 1, matches.len())
} else {
"No matches".to_string()
};
Some(
Label::new(message, theme.search.match_index.text.clone())
.contained()
.with_style(theme.search.match_index.container)
Flex::row()
.with_child(
ChildView::new(&self.query_editor, cx)
.aligned()
.left()
.flex(1., true)
.boxed(),
)
},
))
.contained()
.with_style(editor_container)
.aligned()
.constrained()
.with_min_width(theme.search.editor.min_width)
.with_max_width(theme.search.editor.max_width)
.flex(1., false)
.boxed(),
)
.with_child(
Flex::row()
.with_child(self.render_nav_button("<", Direction::Prev, cx))
.with_child(self.render_nav_button(">", Direction::Next, cx))
.aligned()
.boxed(),
)
.with_child(
Flex::row()
.with_children(self.render_search_option(
supported_options.case,
"Case",
SearchOption::CaseSensitive,
cx,
))
.with_children(self.render_search_option(
supported_options.word,
"Word",
SearchOption::WholeWord,
cx,
))
.with_children(self.render_search_option(
supported_options.regex,
"Regex",
SearchOption::Regex,
cx,
))
.contained()
.with_style(theme.search.option_button_group)
.aligned()
.with_children(self.active_searchable_item.as_ref().and_then(
|searchable_item| {
let matches = self
.seachable_items_with_matches
.get(&searchable_item.downgrade())?;
let message = if let Some(match_ix) = self.active_match_index {
format!("{}/{}", match_ix + 1, matches.len())
} else {
"No matches".to_string()
};
Some(
Label::new(message, theme.search.match_index.text.clone())
.contained()
.with_style(theme.search.match_index.container)
.aligned()
.boxed(),
)
},
))
.contained()
.with_style(editor_container)
.aligned()
.constrained()
.with_min_width(theme.search.editor.min_width)
.with_max_width(theme.search.editor.max_width)
.flex(1., false)
.boxed(),
)
.with_child(
Flex::row()
.with_child(self.render_nav_button("<", Direction::Prev, cx))
.with_child(self.render_nav_button(">", Direction::Next, cx))
.aligned()
.boxed(),
)
.with_child(
Flex::row()
.with_children(self.render_search_option(
supported_options.case,
"Case",
SearchOption::CaseSensitive,
cx,
))
.with_children(self.render_search_option(
supported_options.word,
"Word",
SearchOption::WholeWord,
cx,
))
.with_children(self.render_search_option(
supported_options.regex,
"Regex",
SearchOption::Regex,
cx,
))
.contained()
.with_style(theme.search.option_button_group)
.aligned()
.boxed(),
)
.flex(1., true)
.boxed(),
)
.with_child(self.render_close_button(&theme.search, cx))
.contained()
.with_style(theme.search.container)
.named("search bar")
@@ -325,7 +331,7 @@ impl BufferSearchBar {
let is_active = self.is_search_option_enabled(option);
Some(
MouseEventHandler::<Self>::new(option as usize, cx, |state, cx| {
let style = &cx
let style = cx
.global::<Settings>()
.theme
.search
@@ -373,7 +379,7 @@ impl BufferSearchBar {
enum NavButton {}
MouseEventHandler::<NavButton>::new(direction as usize, cx, |state, cx| {
let style = &cx
let style = cx
.global::<Settings>()
.theme
.search
@@ -399,6 +405,38 @@ impl BufferSearchBar {
.boxed()
}
fn render_close_button(
&self,
theme: &theme::Search,
cx: &mut RenderContext<Self>,
) -> ElementBox {
let action = Box::new(Dismiss);
let tooltip = "Dismiss Buffer Search";
let tooltip_style = cx.global::<Settings>().theme.tooltip.clone();
enum CloseButton {}
MouseEventHandler::<CloseButton>::new(0, cx, |state, _| {
let style = theme.dismiss_button.style_for(state, false);
Svg::new("icons/x_mark_8.svg")
.with_color(style.color)
.constrained()
.with_width(style.icon_width)
.aligned()
.constrained()
.with_width(style.button_width)
.contained()
.with_style(style.container)
.boxed()
})
.on_click(MouseButton::Left, {
let action = action.boxed_clone();
move |_, cx| cx.dispatch_any_action(action.boxed_clone())
})
.with_cursor_style(CursorStyle::PointingHand)
.with_tooltip::<CloseButton, _>(0, tooltip.to_string(), Some(action), tooltip_style, cx)
.boxed()
}
fn deploy(pane: &mut Pane, action: &Deploy, cx: &mut ViewContext<Pane>) {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
if search_bar.update(cx, |search_bar, cx| search_bar.show(action.focus, true, cx)) {

View File

@@ -247,6 +247,7 @@ pub struct Search {
pub results_status: TextStyle,
pub tab_icon_width: f32,
pub tab_icon_spacing: f32,
pub dismiss_button: Interactive<IconButton>,
}
#[derive(Clone, Deserialize, Default)]

View File

@@ -44,6 +44,8 @@ actions!(
ActivateLastItem,
CloseActiveItem,
CloseInactiveItems,
CloseCleanItems,
CloseAllItems,
ReopenClosedItem,
SplitLeft,
SplitUp,
@@ -122,6 +124,8 @@ pub fn init(cx: &mut MutableAppContext) {
});
cx.add_async_action(Pane::close_active_item);
cx.add_async_action(Pane::close_inactive_items);
cx.add_async_action(Pane::close_clean_items);
cx.add_async_action(Pane::close_all_items);
cx.add_async_action(|workspace: &mut Workspace, action: &CloseItem, cx| {
let pane = action.pane.upgrade(cx)?;
let task = Pane::close_item(workspace, pane, action.item_id, cx);
@@ -258,6 +262,13 @@ pub enum ReorderBehavior {
MoveToIndex(usize),
}
enum ItemType {
Active,
Inactive,
Clean,
All,
}
impl Pane {
pub fn new(docked: Option<DockAnchor>, cx: &mut ViewContext<Self>) -> Self {
let handle = cx.weak_handle();
@@ -696,40 +707,67 @@ impl Pane {
_: &CloseActiveItem,
cx: &mut ViewContext<Workspace>,
) -> Option<Task<Result<()>>> {
let pane_handle = workspace.active_pane().clone();
let pane = pane_handle.read(cx);
if pane.items.is_empty() {
None
} else {
let item_id_to_close = pane.items[pane.active_item_index].id();
let task = Self::close_items(workspace, pane_handle, cx, move |item_id| {
item_id == item_id_to_close
});
Some(cx.foreground().spawn(async move {
task.await?;
Ok(())
}))
}
Self::close_main(workspace, ItemType::Active, cx)
}
pub fn close_inactive_items(
workspace: &mut Workspace,
_: &CloseInactiveItems,
cx: &mut ViewContext<Workspace>,
) -> Option<Task<Result<()>>> {
Self::close_main(workspace, ItemType::Inactive, cx)
}
pub fn close_all_items(
workspace: &mut Workspace,
_: &CloseAllItems,
cx: &mut ViewContext<Workspace>,
) -> Option<Task<Result<()>>> {
Self::close_main(workspace, ItemType::All, cx)
}
pub fn close_clean_items(
workspace: &mut Workspace,
_: &CloseCleanItems,
cx: &mut ViewContext<Workspace>,
) -> Option<Task<Result<()>>> {
Self::close_main(workspace, ItemType::Clean, cx)
}
fn close_main(
workspace: &mut Workspace,
close_item_type: ItemType,
cx: &mut ViewContext<Workspace>,
) -> Option<Task<Result<()>>> {
let pane_handle = workspace.active_pane().clone();
let pane = pane_handle.read(cx);
if pane.items.is_empty() {
None
} else {
let active_item_id = pane.items[pane.active_item_index].id();
let task =
Self::close_items(workspace, pane_handle, cx, move |id| id != active_item_id);
Some(cx.foreground().spawn(async move {
task.await?;
Ok(())
}))
return None;
}
let active_item_id = pane.items[pane.active_item_index].id();
let clean_item_ids: Vec<_> = pane
.items()
.filter(|item| !item.is_dirty(cx))
.map(|item| item.id())
.collect();
let task =
Self::close_items(
workspace,
pane_handle,
cx,
move |item_id| match close_item_type {
ItemType::Active => item_id == active_item_id,
ItemType::Inactive => item_id != active_item_id,
ItemType::Clean => clean_item_ids.contains(&item_id),
ItemType::All => true,
},
);
Some(cx.foreground().spawn(async move {
task.await?;
Ok(())
}))
}
pub fn close_item(

View File

@@ -95,7 +95,7 @@ actions!(
ToggleLeftSidebar,
ToggleRightSidebar,
NewTerminal,
NewSearch,
NewSearch
]
);

View File

@@ -30,6 +30,7 @@ clock = { path = "../clock" }
diagnostics = { path = "../diagnostics" }
editor = { path = "../editor" }
file_finder = { path = "../file_finder" }
human_bytes = "0.4.1"
search = { path = "../search" }
fs = { path = "../fs" }
fsevent = { path = "../fsevent" }
@@ -48,6 +49,7 @@ recent_projects = { path = "../recent_projects" }
rpc = { path = "../rpc" }
settings = { path = "../settings" }
sum_tree = { path = "../sum_tree" }
sysinfo = "0.27.1"
text = { path = "../text" }
terminal_view = { path = "../terminal_view" }
theme = { path = "../theme" }
@@ -108,6 +110,7 @@ tree-sitter-html = "0.19.0"
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"}
url = "2.2"
urlencoding = "2.1.2"
[dev-dependencies]
call = { path = "../call", features = ["test-support"] }

View File

@@ -1 +1 @@
dev
preview

View File

@@ -128,8 +128,14 @@ impl LspAdapter for TypeScriptLspAdapter {
Kind::PROPERTY | Kind::FIELD => grammar.highlight_id_for_name("property"),
_ => None,
}?;
let text = match &item.detail {
Some(detail) => format!("{} {}", item.label, detail),
None => item.label.clone(),
};
Some(language::CodeLabel {
text: item.label.clone(),
text,
runs: vec![(0..len, highlight_id)],
filter_range: 0..len,
})

View File

@@ -338,18 +338,25 @@ pub fn menus() -> Vec<Menu<'static>> {
action: Box::new(crate::OpenTelemetryLog),
},
MenuItem::Separator,
MenuItem::Action {
name: "Copy System Specs Into Clipboard",
action: Box::new(crate::CopySystemSpecsIntoClipboard),
},
MenuItem::Action {
name: "File Bug Report",
action: Box::new(crate::FileBugReport),
},
MenuItem::Action {
name: "Request Feature",
action: Box::new(crate::RequestFeature),
},
MenuItem::Separator,
MenuItem::Action {
name: "Documentation",
action: Box::new(crate::OpenBrowser {
url: "https://zed.dev/docs".into(),
}),
},
MenuItem::Action {
name: "Give Feedback",
action: Box::new(crate::OpenBrowser {
url: super::feedback::NEW_ISSUE_URL.into(),
}),
},
MenuItem::Action {
name: "Zed Twitter",
action: Box::new(crate::OpenBrowser {

View File

@@ -0,0 +1,52 @@
use std::{env, fmt::Display};
use gpui::AppContext;
use human_bytes::human_bytes;
use sysinfo::{System, SystemExt};
use util::channel::ReleaseChannel;
pub struct SystemSpecs {
app_version: &'static str,
release_channel: &'static str,
os_name: &'static str,
os_version: Option<String>,
memory: u64,
architecture: &'static str,
}
impl SystemSpecs {
pub fn new(cx: &AppContext) -> Self {
let platform = cx.platform();
let system = System::new_all();
SystemSpecs {
app_version: env!("CARGO_PKG_VERSION"),
release_channel: cx.global::<ReleaseChannel>().dev_name(),
os_name: platform.os_name(),
os_version: platform
.os_version()
.ok()
.map(|os_version| os_version.to_string()),
memory: system.total_memory(),
architecture: env::consts::ARCH,
}
}
}
impl Display for SystemSpecs {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let os_information = match &self.os_version {
Some(os_version) => format!("OS: {} {}", self.os_name, os_version),
None => format!("OS: {}", self.os_name),
};
let system_specs = [
format!("Zed: {} ({})", self.app_version, self.release_channel),
os_information,
format!("Memory: {}", human_bytes(self.memory as f64)),
format!("Architecture: {}", self.architecture),
]
.join("\n");
write!(f, "{system_specs}")
}
}

View File

@@ -1,6 +1,7 @@
mod feedback;
pub mod languages;
pub mod menus;
pub mod system_specs;
#[cfg(any(test, feature = "test-support"))]
pub mod test;
@@ -21,7 +22,7 @@ use gpui::{
},
impl_actions,
platform::{WindowBounds, WindowOptions},
AssetSource, AsyncAppContext, TitlebarOptions, ViewContext, WindowKind,
AssetSource, AsyncAppContext, ClipboardItem, TitlebarOptions, ViewContext, WindowKind,
};
use language::Rope;
use lazy_static::lazy_static;
@@ -33,6 +34,7 @@ use serde::Deserialize;
use serde_json::to_string_pretty;
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
use std::{env, path::Path, str, sync::Arc};
use system_specs::SystemSpecs;
use util::{channel::ReleaseChannel, paths, ResultExt};
pub use workspace;
use workspace::{sidebar::SidebarSide, AppState, Workspace};
@@ -67,6 +69,9 @@ actions!(
ResetBufferFontSize,
InstallCommandLineInterface,
ResetDatabase,
CopySystemSpecsIntoClipboard,
RequestFeature,
FileBugReport
]
);
@@ -245,6 +250,41 @@ 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);
call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
settings::KeymapFileContent::load_defaults(cx);

View File

@@ -32,13 +32,13 @@ export default function contactNotification(colorScheme: ColorScheme): Object {
},
},
dismissButton: {
color: foreground(layer, "on"),
color: foreground(layer, "variant"),
iconWidth: 8,
iconHeight: 8,
buttonWidth: 8,
buttonHeight: 8,
hover: {
color: foreground(layer, "on", "hovered"),
color: foreground(layer, "hovered"),
},
},
};

View File

@@ -257,7 +257,6 @@ export default function editor(colorScheme: ColorScheme) {
right: 6,
},
hover: {
color: foreground(layer, "on", "hovered"),
background: background(layer, "on", "hovered"),
},
},

View File

@@ -80,5 +80,17 @@ export default function search(colorScheme: ColorScheme) {
...text(layer, "mono", "on"),
size: 18,
},
dismissButton: {
color: foreground(layer, "variant"),
iconWidth: 12,
buttonWidth: 14,
padding: {
left: 10,
right: 10,
},
hover: {
color: foreground(layer, "hovered"),
},
},
};
}

View File

@@ -26,7 +26,7 @@ export default function tabBar(colorScheme: ColorScheme) {
// Close icons
iconWidth: 8,
iconClose: foreground(layer, "variant"),
iconCloseActive: foreground(layer),
iconCloseActive: foreground(layer, "hovered"),
// Indicators
iconConflict: foreground(layer, "warning"),