Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ jobs:
run: cargo fmt --all --check

- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
# dead_code is allowed: this codebase deliberately scaffolds UI
# components/helpers ahead of their consumers landing (see e.g.
# crates/workspace/src/panels/log_viewer.rs), so unused-for-now
# code is expected, not a bug. Every other clippy/rustc warning
# still hard-fails.
run: cargo clippy --workspace --all-targets -- -D warnings -A dead_code

- name: Test
run: cargo test --workspace
Expand Down
5 changes: 4 additions & 1 deletion crates/ai/src/providers/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ impl Clusterer for MockProvider {
Some(1)
}
};
ClusterAssignment { data_point_index: i, cluster_id }
ClusterAssignment {
data_point_index: i,
cluster_id,
}
})
.collect();
Ok(assignments)
Expand Down
5 changes: 1 addition & 4 deletions crates/app/src/components/labeled_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ pub struct LabeledSelect<D: SelectItem + 'static> {
}

impl<D: SelectItem + 'static> LabeledSelect<D> {
pub fn new(
label: impl Into<SharedString>,
select: &Entity<SelectState<Vec<D>>>,
) -> Self {
pub fn new(label: impl Into<SharedString>, select: &Entity<SelectState<Vec<D>>>) -> Self {
Self {
label: label.into(),
description: SharedString::default(),
Expand Down
11 changes: 9 additions & 2 deletions crates/app/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,19 @@ pub fn spawn_terminal_at(cwd: &Path, command: &str) -> std::io::Result<()> {
Command::new("osascript").args(["-e", &osa]).spawn()?;
} else {
// Terminal.app accepts a directory argument directly.
Command::new("open").args(["-a", "Terminal"]).arg(cwd).spawn()?;
Command::new("open")
.args(["-a", "Terminal"])
.arg(cwd)
.spawn()?;
}
} else {
let script = format!("cd \"{}\" && {}", cwd.display(), command);
let escaped = escape_applescript(&script);
let app = if term_prog == "iTerm.app" { "iTerm" } else { "Terminal" };
let app = if term_prog == "iTerm.app" {
"iTerm"
} else {
"Terminal"
};
let osa = format!(r#"tell application "{}" to do script "{}""#, app, escaped);
Command::new("osascript").args(["-e", &osa]).spawn()?;
}
Expand Down
23 changes: 9 additions & 14 deletions crates/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@ use settings::{
AppSettings, MainWindowBounds, SettingsPersistence, SettingsWindow, SettingsWindowHandle,
SettingsWriter, load_app_settings,
};
use window_wrapper::{
status_bar::StatusBar,
title_bar::AppTitleBar,
OpenBrowser, WindowLock,
};
use window_wrapper::{OpenBrowser, WindowLock, status_bar::StatusBar, title_bar::AppTitleBar};

use crate::app_settings::build_pages;
use crate::{
actions::{ToggleBottomDock, ToggleLeftDock, ToggleRightDock},
app_menus::{OpenSettings, Quit, app_menus},
status_items::build_status_bar_registry,
title_items::build_title_bar_registry,
};
use gpui_component::dock::DockPlacement;
use crate::app_settings::build_pages;
use workspace::Workspace;

pub struct App {
Expand Down Expand Up @@ -53,9 +49,7 @@ impl App {
});

// Block the OS close button while a background task is running.
window.on_window_should_close(cx, |_, cx| {
!WindowLock::is_locked(cx)
});
window.on_window_should_close(cx, |_, cx| !WindowLock::is_locked(cx));

Self {
workspace,
Expand Down Expand Up @@ -126,10 +120,10 @@ fn main() {
writer: Some(SettingsWriter::start()),
});
cx.set_global(SettingsWindowHandle::default());

cx.on_action(|_: &OpenSettings, cx| {
let state = cx.global::<SettingsWindowHandle>();

if let Some(handle) = &state.handle {
if handle.update(cx, |_, _, _| {}).is_ok() {
return;
Expand All @@ -150,11 +144,12 @@ fn main() {
let view = cx.new(|cx| SettingsWindow::new(window, cx, build_pages));
cx.new(|cx| Root::new(view, window, cx))
});

if let Ok(window_handle) = result {
cx.update(|cx| {
cx.global_mut::<SettingsWindowHandle>().handle = Some(window_handle.into());
}).ok();
})
.ok();
}
})
.detach();
Expand All @@ -173,7 +168,7 @@ fn main() {

cx.on_action(|_: &Quit, cx| {
cx.quit();
});
});
let min_size = Size::new(px(520.0), px(300.0));

let window_options = WindowOptions {
Expand Down
12 changes: 10 additions & 2 deletions crates/app/src/title_items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ pub fn build_title_bar_registry(cx: &mut App, dock: WeakEntity<DockArea>) -> Tit

for (id, placement, icon) in [
("title-panel-left", DockPlacement::Left, IconName::PanelLeft),
("title-panel-bottom", DockPlacement::Bottom, IconName::PanelBottom),
("title-panel-right", DockPlacement::Right, IconName::PanelRight),
(
"title-panel-bottom",
DockPlacement::Bottom,
IconName::PanelBottom,
),
(
"title-panel-right",
DockPlacement::Right,
IconName::PanelRight,
),
] {
let btn = cx.new(|_| DockToggleButton::new(id, dock.clone(), placement, icon));
registry.add_right(btn);
Expand Down
Loading
Loading