refactor(app): extract app-base crate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -276,6 +276,7 @@ name = "app"
276
276
version = "0.1.0"
277
277
dependencies = [
278
278
"agents",
279
"app-base",
279
280
"calling",
280
281
"chatsvc",
281
282
"chrono",
@@ -287,9 +288,7 @@ dependencies = [
287
288
"image",
288
289
"log",
289
290
"mcp",
290
"raw-window-handle",
291
291
"regex",
292
"rodio",
293
292
"serde",
294
293
"serde_json",
295
294
"session",
@@ -297,9 +296,33 @@ dependencies = [
297
296
"teams-core",
298
297
"tempfile",
299
298
"tokio",
300
"tray-icon",
301
299
"uuid",
302
300
"webview",
301
]
302
303
[[package]]
304
name = "app-base"
305
version = "0.1.0"
306
dependencies = [
307
"agents",
308
"calling",
309
"chatsvc",
310
"chrono",
311
"directories",
312
"gpui-kit",
313
"image",
314
"log",
315
"mcp",
316
"raw-window-handle",
317
"rodio",
318
"serde",
319
"serde_json",
320
"session",
321
"store",
322
"teams-core",
323
"tempfile",
324
"tokio",
325
"tray-icon",
303
326
"windows 0.62.2",
304
327
"x11rb",
305
328
]
@@ -276,6 +276,7 @@ name = "app"276
version = "0.1.0"276
version = "0.1.0"277
dependencies = [277
dependencies = [278
"agents",278
"agents",279
"app-base",279
"calling",280
"calling",280
"chatsvc",281
"chatsvc",281
"chrono",282
"chrono",@@ -287,9 +288,7 @@ dependencies = [287
"image",288
"image",288
"log",289
"log",289
"mcp",290
"mcp",290
"raw-window-handle",291
"regex",291
"regex",292
"rodio",293
"serde",292
"serde",294
"serde_json",293
"serde_json",295
"session",294
"session",@@ -297,9 +296,33 @@ dependencies = [297
"teams-core",296
"teams-core",298
"tempfile",297
"tempfile",299
"tokio",298
"tokio",300
"tray-icon",301
"uuid",299
"uuid",302
"webview",300
"webview",301
]302
303
[[package]]304
name = "app-base"305
version = "0.1.0"306
dependencies = [307
"agents",308
"calling",309
"chatsvc",310
"chrono",311
"directories",312
"gpui-kit",313
"image",314
"log",315
"mcp",316
"raw-window-handle",317
"rodio",318
"serde",319
"serde_json",320
"session",321
"store",322
"teams-core",323
"tempfile",324
"tokio",325
"tray-icon",303
"windows 0.62.2",326
"windows 0.62.2",304
"x11rb",327
"x11rb",305
]328
]@@ -28,6 +28,7 @@ tokio-tungstenite = { version = "0.28", default-features = false, features = ["c
28
28
url = "2"
29
29
uuid = { version = "1", default-features = false, features = ["v4"] }
30
30
31
app-base = { path = "crates/app-base" }
31
32
agents = { path = "crates/agents" }
32
33
session = { path = "crates/session" }
33
34
graph = { path = "crates/graph" }
@@ -54,3 +55,6 @@ codegen-units = 16
54
55
55
56
[profile.release.package.app]
56
57
opt-level = 1
58
59
[profile.release.package.app-base]
60
opt-level = 1
@@ -28,6 +28,7 @@ tokio-tungstenite = { version = "0.28", default-features = false, features = ["c28
url = "2"28
url = "2"29
uuid = { version = "1", default-features = false, features = ["v4"] }29
uuid = { version = "1", default-features = false, features = ["v4"] }30
30
31
app-base = { path = "crates/app-base" }31
agents = { path = "crates/agents" }32
agents = { path = "crates/agents" }32
session = { path = "crates/session" }33
session = { path = "crates/session" }33
graph = { path = "crates/graph" }34
graph = { path = "crates/graph" }@@ -54,3 +55,6 @@ codegen-units = 1654
55
55
[profile.release.package.app]56
[profile.release.package.app]56
opt-level = 157
opt-level = 158
59
[profile.release.package.app-base]60
opt-level = 1@@ -0,0 +1,51 @@
1
[package]
2
name = "app-base"
3
edition.workspace = true
4
version.workspace = true
5
license.workspace = true
6
publish.workspace = true
7
8
[dev-dependencies]
9
gpui-kit = { workspace = true, features = ["test-support"] }
10
tempfile.workspace = true
11
12
[dependencies]
13
agents.workspace = true
14
calling.workspace = true
15
chatsvc.workspace = true
16
chrono.workspace = true
17
directories.workspace = true
18
gpui-kit.workspace = true
19
log = "0.4"
20
mcp.workspace = true
21
serde.workspace = true
22
serde_json.workspace = true
23
session.workspace = true
24
store.workspace = true
25
teams-core.workspace = true
26
tokio.workspace = true
27
image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "webp"] }
28
29
[target.'cfg(target_os = "linux")'.dependencies]
30
raw-window-handle = "0.6"
31
x11rb = { version = "0.13", features = ["shape"] }
32
33
[target.'cfg(windows)'.dependencies]
34
raw-window-handle = "0.6"
35
rodio = { version = "0.22", default-features = false, features = ["playback", "mp3"] }
36
tray-icon = { version = "0.21", default-features = false }
37
windows = { version = "0.62", features = [
38
"Win32_Foundation",
39
"Win32_Graphics_Dwm",
40
"Win32_Graphics_Gdi",
41
"Win32_Security",
42
"Win32_Storage_FileSystem",
43
"Win32_System_Com",
44
"Win32_System_Pipes",
45
"Win32_System_SystemInformation",
46
"Win32_System_Threading",
47
"Win32_UI_HiDpi",
48
"Win32_UI_Input_KeyboardAndMouse",
49
"Win32_UI_Shell",
50
"Win32_UI_WindowsAndMessaging",
51
] }
@@ -0,0 +1,51 @@1
[package]2
name = "app-base"3
edition.workspace = true4
version.workspace = true5
license.workspace = true6
publish.workspace = true7
8
[dev-dependencies]9
gpui-kit = { workspace = true, features = ["test-support"] }10
tempfile.workspace = true11
12
[dependencies]13
agents.workspace = true14
calling.workspace = true15
chatsvc.workspace = true16
chrono.workspace = true17
directories.workspace = true18
gpui-kit.workspace = true19
log = "0.4"20
mcp.workspace = true21
serde.workspace = true22
serde_json.workspace = true23
session.workspace = true24
store.workspace = true25
teams-core.workspace = true26
tokio.workspace = true27
image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "webp"] }28
29
[target.'cfg(target_os = "linux")'.dependencies]30
raw-window-handle = "0.6"31
x11rb = { version = "0.13", features = ["shape"] }32
33
[target.'cfg(windows)'.dependencies]34
raw-window-handle = "0.6"35
rodio = { version = "0.22", default-features = false, features = ["playback", "mp3"] }36
tray-icon = { version = "0.21", default-features = false }37
windows = { version = "0.62", features = [38
"Win32_Foundation",39
"Win32_Graphics_Dwm",40
"Win32_Graphics_Gdi",41
"Win32_Security",42
"Win32_Storage_FileSystem",43
"Win32_System_Com",44
"Win32_System_Pipes",45
"Win32_System_SystemInformation",46
"Win32_System_Threading",47
"Win32_UI_HiDpi",48
"Win32_UI_Input_KeyboardAndMouse",49
"Win32_UI_Shell",50
"Win32_UI_WindowsAndMessaging",51
] }@@ -0,0 +1,2 @@
1
pub mod extras;
2
pub mod image_scale;
@@ -0,0 +1,2 @@1
pub mod extras;2
pub mod image_scale;@@ -0,0 +1,2 @@
1
pub mod lanes;
2
pub mod settings_problems;
@@ -0,0 +1,2 @@1
pub mod lanes;2
pub mod settings_problems;@@ -4,7 +4,7 @@ use gpui_kit::{AssetSource, Result, SharedString};
4
4
5
5
macro_rules! symbols {
6
6
($($name:literal),* $(,)?) => {
7
[$((concat!("symbols/", $name, ".svg"), include_bytes!(concat!("../assets/symbols/", $name, ".svg")) as &[u8])),*]
7
[$((concat!("symbols/", $name, ".svg"), include_bytes!(concat!("../../app/assets/symbols/", $name, ".svg")) as &[u8])),*]
8
8
};
9
9
}
10
10
@@ -4,7 +4,7 @@ use gpui_kit::{AssetSource, Result, SharedString};4
4
5
macro_rules! symbols {5
macro_rules! symbols {6
($($name:literal),* $(,)?) => {6
($($name:literal),* $(,)?) => {7
[$((concat!("symbols/", $name, ".svg"), include_bytes!(concat!("../assets/symbols/", $name, ".svg")) as &[u8])),*]7
[$((concat!("symbols/", $name, ".svg"), include_bytes!(concat!("../../app/assets/symbols/", $name, ".svg")) as &[u8])),*]8
};8
};9
}9
}10
10
@@ -32,7 +32,7 @@ fn entry(info: &PanicHookInfo<'_>, backtrace: &str) -> String {
32
32
format!(
33
33
"=== {} build {} thread {}\npanic at {location}: {}\n{backtrace}\n",
34
34
chrono::Utc::now().to_rfc3339(),
35
env!("TEAMS_BUILD_VERSION"),
35
crate::version::build_version(),
36
36
thread.name().unwrap_or("unnamed"),
37
37
message(info),
38
38
)
@@ -32,7 +32,7 @@ fn entry(info: &PanicHookInfo<'_>, backtrace: &str) -> String {32
format!(32
format!(33
"=== {} build {} thread {}\npanic at {location}: {}\n{backtrace}\n",33
"=== {} build {} thread {}\npanic at {location}: {}\n{backtrace}\n",34
chrono::Utc::now().to_rfc3339(),34
chrono::Utc::now().to_rfc3339(),35
env!("TEAMS_BUILD_VERSION"),35
crate::version::build_version(),36
thread.name().unwrap_or("unnamed"),36
thread.name().unwrap_or("unnamed"),37
message(info),37
message(info),38
)38
)@@ -86,7 +86,7 @@ fn line_prefix() -> String {
86
86
format!(
87
87
"{} {}",
88
88
chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ"),
89
env!("TEAMS_BUILD_VERSION")
89
crate::version::build_version()
90
90
)
91
91
}
92
92
@@ -86,7 +86,7 @@ fn line_prefix() -> String {86
format!(86
format!(87
"{} {}",87
"{} {}",88
chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ"),88
chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ"),89
env!("TEAMS_BUILD_VERSION")89
crate::version::build_version()90
)90
)91
}91
}92
92
@@ -0,0 +1 @@
1
pub mod typing;
@@ -0,0 +1 @@1
pub mod typing;@@ -0,0 +1,36 @@
1
pub mod agent_api;
2
pub mod agents;
3
pub mod assets;
4
pub mod avatar_image;
5
pub mod channel_files;
6
pub mod crash_log;
7
pub mod demo_cards;
8
pub mod demo_chart_cards;
9
pub mod demo_gifs;
10
pub mod demo_input_cards;
11
pub mod demo_library;
12
pub mod demo_recap;
13
pub mod diagnostics;
14
pub mod downloads;
15
pub mod emoji;
16
pub mod format;
17
pub mod frame_log;
18
pub mod fuzzy;
19
pub mod image_view_math;
20
pub mod notify;
21
pub mod presence_link;
22
pub mod read_state;
23
pub mod recap;
24
pub mod remote_image;
25
pub mod runtime;
26
pub mod schedule_time;
27
pub mod single_instance;
28
pub mod stickers;
29
pub mod task_dialog;
30
pub mod theme;
31
pub mod translation;
32
pub mod updater;
33
pub mod user_activity;
34
pub mod version;
35
36
pub const APP_NAME: &str = "Rusty Teams";
@@ -0,0 +1,36 @@1
pub mod agent_api;2
pub mod agents;3
pub mod assets;4
pub mod avatar_image;5
pub mod channel_files;6
pub mod crash_log;7
pub mod demo_cards;8
pub mod demo_chart_cards;9
pub mod demo_gifs;10
pub mod demo_input_cards;11
pub mod demo_library;12
pub mod demo_recap;13
pub mod diagnostics;14
pub mod downloads;15
pub mod emoji;16
pub mod format;17
pub mod frame_log;18
pub mod fuzzy;19
pub mod image_view_math;20
pub mod notify;21
pub mod presence_link;22
pub mod read_state;23
pub mod recap;24
pub mod remote_image;25
pub mod runtime;26
pub mod schedule_time;27
pub mod single_instance;28
pub mod stickers;29
pub mod task_dialog;30
pub mod theme;31
pub mod translation;32
pub mod updater;33
pub mod user_activity;34
pub mod version;35
36
pub const APP_NAME: &str = "Rusty Teams";@@ -0,0 +1,6 @@
1
#[cfg_attr(not(windows), allow(dead_code))]
2
pub mod badge;
3
#[cfg_attr(not(windows), allow(dead_code))]
4
pub mod platform;
5
#[cfg_attr(not(windows), allow(dead_code))]
6
pub mod ring_tone;
@@ -0,0 +1,6 @@1
#[cfg_attr(not(windows), allow(dead_code))]2
pub mod badge;3
#[cfg_attr(not(windows), allow(dead_code))]4
pub mod platform;5
#[cfg_attr(not(windows), allow(dead_code))]6
pub mod ring_tone;@@ -45,8 +45,8 @@ use super::{NativeHandle, ScreenRect, ShareGeometry, TrayCommand, WorkArea};
45
45
use crate::notify::badge::{BADGE_SIZE, Badge, render_badge};
46
46
use crate::notify::ring_tone::{Ringtone, SAMPLE_RATE, ringback_cycle};
47
47
48
const SOUND_BYTES: &[u8] = include_bytes!("../../../assets/sounds/notification.mp3");
49
const TRAY_ICON_PNG: &[u8] = include_bytes!("../../../assets/icon/teams-fast-256.png");
48
const SOUND_BYTES: &[u8] = include_bytes!("../../../../app/assets/sounds/notification.mp3");
49
const TRAY_ICON_PNG: &[u8] = include_bytes!("../../../../app/assets/icon/teams-fast-256.png");
50
50
const TRAY_ICON_SIZE: u32 = 32;
51
51
const TRAY_DOT_RADIUS: f32 = 6.;
52
52
const BASE_DPI: f32 = 96.;
@@ -45,8 +45,8 @@ use super::{NativeHandle, ScreenRect, ShareGeometry, TrayCommand, WorkArea};45
use crate::notify::badge::{BADGE_SIZE, Badge, render_badge};45
use crate::notify::badge::{BADGE_SIZE, Badge, render_badge};46
use crate::notify::ring_tone::{Ringtone, SAMPLE_RATE, ringback_cycle};46
use crate::notify::ring_tone::{Ringtone, SAMPLE_RATE, ringback_cycle};47
47
48
const SOUND_BYTES: &[u8] = include_bytes!("../../../assets/sounds/notification.mp3");48
const SOUND_BYTES: &[u8] = include_bytes!("../../../../app/assets/sounds/notification.mp3");49
const TRAY_ICON_PNG: &[u8] = include_bytes!("../../../assets/icon/teams-fast-256.png");49
const TRAY_ICON_PNG: &[u8] = include_bytes!("../../../../app/assets/icon/teams-fast-256.png");50
const TRAY_ICON_SIZE: u32 = 32;50
const TRAY_ICON_SIZE: u32 = 32;51
const TRAY_DOT_RADIUS: f32 = 6.;51
const TRAY_DOT_RADIUS: f32 = 6.;52
const BASE_DPI: f32 = 96.;52
const BASE_DPI: f32 = 96.;@@ -1,6 +1,6 @@
1
1
use std::sync::OnceLock;
2
2
3
const CATALOG: &str = include_str!("../assets/stickers.tsv");
3
const CATALOG: &str = include_str!("../../app/assets/stickers.tsv");
4
4
const IMAGE_BASE: &str = "https://statics.teams.cdn.office.net/evergreen-assets/stickerassets";
5
5
const IMAGE_VERSION: u32 = 5;
6
6
const POPULAR_IDS: [&str; 6] = [
@@ -1,6 +1,6 @@1
use std::sync::OnceLock;1
use std::sync::OnceLock;2
2
3
const CATALOG: &str = include_str!("../assets/stickers.tsv");3
const CATALOG: &str = include_str!("../../app/assets/stickers.tsv");4
const IMAGE_BASE: &str = "https://statics.teams.cdn.office.net/evergreen-assets/stickerassets";4
const IMAGE_BASE: &str = "https://statics.teams.cdn.office.net/evergreen-assets/stickerassets";5
const IMAGE_VERSION: u32 = 5;5
const IMAGE_VERSION: u32 = 5;6
const POPULAR_IDS: [&str; 6] = [6
const POPULAR_IDS: [&str; 6] = [@@ -0,0 +1 @@
1
pub mod sdk;
@@ -0,0 +1 @@1
pub mod sdk;@@ -7,10 +7,10 @@ const FONT_FAMILY: &str = "Google Sans Flex";
7
7
const MONO_FAMILIES: [&str; 2] = ["Cascadia Code", "Consolas"];
8
8
const BASE_FONT_SIZE: f32 = 14.;
9
9
const FONT_FILES: [&[u8]; 4] = [
10
include_bytes!("../assets/fonts/GoogleSansFlex-Regular.ttf"),
11
include_bytes!("../assets/fonts/GoogleSansFlex-SemiBold.ttf"),
12
include_bytes!("../assets/fonts/GoogleSansFlex-Bold.ttf"),
13
include_bytes!("../assets/fonts/GoogleSansFlex-Italic.ttf"),
10
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Regular.ttf"),
11
include_bytes!("../../app/assets/fonts/GoogleSansFlex-SemiBold.ttf"),
12
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Bold.ttf"),
13
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Italic.ttf"),
14
14
];
15
15
16
16
pub const BACKGROUND: u32 = 0x0f0f10;
@@ -7,10 +7,10 @@ const FONT_FAMILY: &str = "Google Sans Flex";7
const MONO_FAMILIES: [&str; 2] = ["Cascadia Code", "Consolas"];7
const MONO_FAMILIES: [&str; 2] = ["Cascadia Code", "Consolas"];8
const BASE_FONT_SIZE: f32 = 14.;8
const BASE_FONT_SIZE: f32 = 14.;9
const FONT_FILES: [&[u8]; 4] = [9
const FONT_FILES: [&[u8]; 4] = [10
include_bytes!("../assets/fonts/GoogleSansFlex-Regular.ttf"),10
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Regular.ttf"),11
include_bytes!("../assets/fonts/GoogleSansFlex-SemiBold.ttf"),11
include_bytes!("../../app/assets/fonts/GoogleSansFlex-SemiBold.ttf"),12
include_bytes!("../assets/fonts/GoogleSansFlex-Bold.ttf"),12
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Bold.ttf"),13
include_bytes!("../assets/fonts/GoogleSansFlex-Italic.ttf"),13
include_bytes!("../../app/assets/fonts/GoogleSansFlex-Italic.ttf"),14
];14
];15
15
16
pub const BACKGROUND: u32 = 0x0f0f10;16
pub const BACKGROUND: u32 = 0x0f0f10;@@ -7,7 +7,6 @@ use std::time::Duration;
7
7
8
8
pub const POLL_INTERVAL: Duration = Duration::from_secs(15);
9
9
10
const VERSION_MARKER: &str = concat!("teams-build:", env!("TEAMS_BUILD_VERSION"));
11
10
const UPDATE_DIRECTORY: &str = "update";
12
11
const EXE_NAME: &str = "teams.exe";
13
12
const OLD_EXE_NAME: &str = "teams.old.exe";
@@ -20,7 +19,7 @@ const QUIT_GRACE: Duration = Duration::from_secs(3);
20
19
const PREVIOUS_EXIT_TIMEOUT: Duration = Duration::from_secs(30);
21
20
22
21
pub fn running_version() -> &'static str {
23
VERSION_MARKER.trim_start_matches("teams-build:")
22
crate::version::build_version()
24
23
}
25
24
26
25
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -426,8 +425,7 @@ mod tests {
426
425
}
427
426
428
427
#[test]
429
fn running_version_has_no_marker_prefix() {
430
assert!(!running_version().starts_with("teams-build:"));
428
fn running_version_is_set() {
431
429
assert!(!running_version().is_empty());
432
430
}
433
431
}
@@ -7,7 +7,6 @@ use std::time::Duration;7
7
8
pub const POLL_INTERVAL: Duration = Duration::from_secs(15);8
pub const POLL_INTERVAL: Duration = Duration::from_secs(15);9
9
10
const VERSION_MARKER: &str = concat!("teams-build:", env!("TEAMS_BUILD_VERSION"));11
const UPDATE_DIRECTORY: &str = "update";10
const UPDATE_DIRECTORY: &str = "update";12
const EXE_NAME: &str = "teams.exe";11
const EXE_NAME: &str = "teams.exe";13
const OLD_EXE_NAME: &str = "teams.old.exe";12
const OLD_EXE_NAME: &str = "teams.old.exe";@@ -20,7 +19,7 @@ const QUIT_GRACE: Duration = Duration::from_secs(3);20
const PREVIOUS_EXIT_TIMEOUT: Duration = Duration::from_secs(30);19
const PREVIOUS_EXIT_TIMEOUT: Duration = Duration::from_secs(30);21
20
22
pub fn running_version() -> &'static str {21
pub fn running_version() -> &'static str {23
VERSION_MARKER.trim_start_matches("teams-build:")22
crate::version::build_version()24
}23
}25
24
26
#[derive(Debug, Clone, PartialEq, Eq)]25
#[derive(Debug, Clone, PartialEq, Eq)]@@ -426,8 +425,7 @@ mod tests {426
}425
}427
426
428
#[test]427
#[test]429
fn running_version_has_no_marker_prefix() {428
fn running_version_is_set() {430
assert!(!running_version().starts_with("teams-build:"));431
assert!(!running_version().is_empty());429
assert!(!running_version().is_empty());432
}430
}433
}431
}@@ -0,0 +1,11 @@
1
use std::sync::OnceLock;
2
3
static BUILD_VERSION: OnceLock<&'static str> = OnceLock::new();
4
5
pub fn set_build_version(version: &'static str) {
6
let _ = BUILD_VERSION.set(version);
7
}
8
9
pub fn build_version() -> &'static str {
10
BUILD_VERSION.get().copied().unwrap_or("unknown")
11
}
@@ -0,0 +1,11 @@1
use std::sync::OnceLock;2
3
static BUILD_VERSION: OnceLock<&'static str> = OnceLock::new();4
5
pub fn set_build_version(version: &'static str) {6
let _ = BUILD_VERSION.set(version);7
}8
9
pub fn build_version() -> &'static str {10
BUILD_VERSION.get().copied().unwrap_or("unknown")11
}@@ -18,6 +18,7 @@ gpui-kit = { workspace = true, features = ["test-support"] }
18
18
tempfile.workspace = true
19
19
20
20
[dependencies]
21
app-base.workspace = true
21
22
agents.workspace = true
22
23
calling.workspace = true
23
24
chatsvc.workspace = true
@@ -38,27 +39,5 @@ tokio.workspace = true
38
39
uuid.workspace = true
39
40
image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "webp"] }
40
41
41
[target.'cfg(target_os = "linux")'.dependencies]
42
raw-window-handle = "0.6"
43
x11rb = { version = "0.13", features = ["shape"] }
44
45
42
[target.'cfg(windows)'.dependencies]
46
43
webview.workspace = true
47
raw-window-handle = "0.6"
48
rodio = { version = "0.22", default-features = false, features = ["playback", "mp3"] }
49
tray-icon = { version = "0.21", default-features = false }
50
windows = { version = "0.62", features = [
51
"Win32_Foundation",
52
"Win32_Graphics_Dwm",
53
"Win32_Graphics_Gdi",
54
"Win32_Security",
55
"Win32_Storage_FileSystem",
56
"Win32_System_Com",
57
"Win32_System_Pipes",
58
"Win32_System_SystemInformation",
59
"Win32_System_Threading",
60
"Win32_UI_HiDpi",
61
"Win32_UI_Input_KeyboardAndMouse",
62
"Win32_UI_Shell",
63
"Win32_UI_WindowsAndMessaging",
64
] }
@@ -18,6 +18,7 @@ gpui-kit = { workspace = true, features = ["test-support"] }18
tempfile.workspace = true18
tempfile.workspace = true19
19
20
[dependencies]20
[dependencies]21
app-base.workspace = true21
agents.workspace = true22
agents.workspace = true22
calling.workspace = true23
calling.workspace = true23
chatsvc.workspace = true24
chatsvc.workspace = true@@ -38,27 +39,5 @@ tokio.workspace = true38
uuid.workspace = true39
uuid.workspace = true39
image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "webp"] }40
image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "webp"] }40
41
41
[target.'cfg(target_os = "linux")'.dependencies]42
raw-window-handle = "0.6"43
x11rb = { version = "0.13", features = ["shape"] }44
45
[target.'cfg(windows)'.dependencies]42
[target.'cfg(windows)'.dependencies]46
webview.workspace = true43
webview.workspace = true47
raw-window-handle = "0.6"48
rodio = { version = "0.22", default-features = false, features = ["playback", "mp3"] }49
tray-icon = { version = "0.21", default-features = false }50
windows = { version = "0.62", features = [51
"Win32_Foundation",52
"Win32_Graphics_Dwm",53
"Win32_Graphics_Gdi",54
"Win32_Security",55
"Win32_Storage_FileSystem",56
"Win32_System_Com",57
"Win32_System_Pipes",58
"Win32_System_SystemInformation",59
"Win32_System_Threading",60
"Win32_UI_HiDpi",61
"Win32_UI_Input_KeyboardAndMouse",62
"Win32_UI_Shell",63
"Win32_UI_WindowsAndMessaging",64
] }@@ -1,6 +1,4 @@
1
1
mod bridge;
2
mod extras;
3
mod image_scale;
4
2
mod source;
5
3
6
4
use std::collections::{BTreeSet, HashMap};
@@ -14,6 +12,7 @@ use mcp::{
14
12
ReactionProposal, ServerHandle,
15
13
};
16
14
use store::Store;
15
use app_base::agent_api::{extras, image_scale};
17
16
18
17
use crate::backend::Engine;
19
18
use crate::runtime;
@@ -1,6 +1,4 @@1
mod bridge;1
mod bridge;2
mod extras;3
mod image_scale;4
mod source;2
mod source;5
3
6
use std::collections::{BTreeSet, HashMap};4
use std::collections::{BTreeSet, HashMap};@@ -14,6 +12,7 @@ use mcp::{14
ReactionProposal, ServerHandle,12
ReactionProposal, ServerHandle,15
};13
};16
use store::Store;14
use store::Store;15
use app_base::agent_api::{extras, image_scale};17
16
18
use crate::backend::Engine;17
use crate::backend::Engine;19
use crate::runtime;18
use crate::runtime;@@ -1,6 +1,5 @@
1
1
mod demo;
2
2
mod kills;
3
mod lanes;
4
3
mod mcp_bridge;
5
4
mod message_context;
6
5
mod run_chip;
@@ -9,7 +8,6 @@ mod runs_popover;
9
8
mod session_options;
10
9
mod settings_controls;
11
10
mod settings_forms;
12
mod settings_problems;
13
11
mod settings_section;
14
12
mod spinner;
15
13
mod start_dialog;
@@ -19,6 +17,7 @@ mod store;
19
17
use std::path::PathBuf;
20
18
use std::time::Duration;
21
19
20
use app_base::agents::{lanes, settings_problems};
22
21
use agents::{AgentAction, Environment};
23
22
use directories::ProjectDirs;
24
23
use gpui_kit::*;
@@ -1,6 +1,5 @@1
mod demo;1
mod demo;2
mod kills;2
mod kills;3
mod lanes;4
mod mcp_bridge;3
mod mcp_bridge;5
mod message_context;4
mod message_context;6
mod run_chip;5
mod run_chip;@@ -9,7 +8,6 @@ mod runs_popover;9
mod session_options;8
mod session_options;10
mod settings_controls;9
mod settings_controls;11
mod settings_forms;10
mod settings_forms;12
mod settings_problems;13
mod settings_section;11
mod settings_section;14
mod spinner;12
mod spinner;15
mod start_dialog;13
mod start_dialog;@@ -19,6 +17,7 @@ mod store;19
use std::path::PathBuf;17
use std::path::PathBuf;20
use std::time::Duration;18
use std::time::Duration;21
19
20
use app_base::agents::{lanes, settings_problems};22
use agents::{AgentAction, Environment};21
use agents::{AgentAction, Environment};23
use directories::ProjectDirs;22
use directories::ProjectDirs;24
use gpui_kit::*;23
use gpui_kit::*;@@ -1,6 +1,6 @@
1
1
mod recent;
2
mod typing;
3
2
3
use app_base::emoji::typing;
4
4
use std::ops::Range;
5
5
use std::sync::OnceLock;
6
6
@@ -1,6 +1,6 @@1
mod recent;1
mod recent;2
mod typing;3
2
3
use app_base::emoji::typing;4
use std::ops::Range;4
use std::ops::Range;5
use std::sync::OnceLock;5
use std::sync::OnceLock;6
6
@@ -10,6 +10,22 @@ const SCAN_ALLOWLIST: &[(&str, &str)] = &[
10
10
("views/conversation.rs", ".bottom(px(-1.))"),
11
11
];
12
12
13
fn source_roots() -> Vec<PathBuf> {
14
let crates_directory = Path::new(env!("CARGO_MANIFEST_DIR")).join("..");
15
let mut roots: Vec<PathBuf> = fs::read_dir(&crates_directory)
16
.expect("read crates directory")
17
.map(|entry| entry.expect("directory entry").path())
18
.filter(|path| {
19
path.file_name()
20
.is_some_and(|name| name.to_string_lossy().starts_with("app"))
21
})
22
.map(|path| path.join("src"))
23
.filter(|path| path.is_dir())
24
.collect();
25
roots.sort();
26
roots
27
}
28
13
29
fn source_files(directory: &Path, files: &mut Vec<PathBuf>) {
14
30
for entry in fs::read_dir(directory).expect("read source directory") {
15
31
let path = entry.expect("directory entry").path();
@@ -64,30 +80,31 @@ fn matcher_matches_allowlist_from_match_start() {
64
80
65
81
#[test]
66
82
fn negative_offsets_go_through_corner_badge() {
67
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
68
83
let pattern = offset_pattern();
69
let mut files = Vec::new();
70
source_files(&root, &mut files);
71
84
let mut matched_allowlist = HashSet::new();
72
85
let mut violations = Vec::new();
73
for file in files {
74
let relative = file
75
.strip_prefix(&root)
76
.expect("inside src")
77
.to_string_lossy()
78
.replace('\\', "/");
79
if relative == WIDGETS_FILE || relative == "layout_guard.rs" {
80
continue;
81
}
82
let source = fs::read_to_string(&file).expect("read source file");
83
for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {
84
match position {
85
Some(position) => {
86
matched_allowlist.insert(position);
86
for root in source_roots() {
87
let mut files = Vec::new();
88
source_files(&root, &mut files);
89
for file in files {
90
let relative = file
91
.strip_prefix(&root)
92
.expect("inside src")
93
.to_string_lossy()
94
.replace('\\', "/");
95
if relative == WIDGETS_FILE || relative == "layout_guard.rs" {
96
continue;
97
}
98
let source = fs::read_to_string(&file).expect("read source file");
99
for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {
100
match position {
101
Some(position) => {
102
matched_allowlist.insert(position);
103
}
104
None => violations.push(format!(
105
"{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"
106
)),
87
107
}
88
None => violations.push(format!(
89
"{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"
90
)),
91
108
}
92
109
}
93
110
}
@@ -108,6 +125,32 @@ fn negative_offsets_go_through_corner_badge() {
108
125
);
109
126
}
110
127
128
#[test]
129
fn hover_styles_never_toggle_display() {
130
let toggle =
131
Regex::new(r"hover\([^|]*\|\w+\|\s*\w+\s*\.\s*(hidden|flex|block|grid)\(\)").unwrap();
132
let mut files = Vec::new();
133
for root in source_roots() {
134
source_files(&root, &mut files);
135
}
136
let offenders: Vec<String> = files
137
.iter()
138
.flat_map(|path| {
139
let source = fs::read_to_string(path).unwrap();
140
source
141
.lines()
142
.enumerate()
143
.filter(|(_, line)| toggle.is_match(line))
144
.map(|(index, _)| format!("{}:{}", path.display(), index + 1))
145
.collect::<Vec<_>>()
146
})
147
.collect();
148
assert!(
149
offenders.is_empty(),
150
"hover styles must toggle visible()/invisible(), not display (gpui panics \"must call prepaint before paint\"): {offenders:?}"
151
);
152
}
153
111
154
mod frames {
112
155
use std::collections::HashSet;
113
156
use std::sync::Arc;
@@ -10,6 +10,22 @@ const SCAN_ALLOWLIST: &[(&str, &str)] = &[10
("views/conversation.rs", ".bottom(px(-1.))"),10
("views/conversation.rs", ".bottom(px(-1.))"),11
];11
];12
12
13
fn source_roots() -> Vec<PathBuf> {14
let crates_directory = Path::new(env!("CARGO_MANIFEST_DIR")).join("..");15
let mut roots: Vec<PathBuf> = fs::read_dir(&crates_directory)16
.expect("read crates directory")17
.map(|entry| entry.expect("directory entry").path())18
.filter(|path| {19
path.file_name()20
.is_some_and(|name| name.to_string_lossy().starts_with("app"))21
})22
.map(|path| path.join("src"))23
.filter(|path| path.is_dir())24
.collect();25
roots.sort();26
roots27
}28
13
fn source_files(directory: &Path, files: &mut Vec<PathBuf>) {29
fn source_files(directory: &Path, files: &mut Vec<PathBuf>) {14
for entry in fs::read_dir(directory).expect("read source directory") {30
for entry in fs::read_dir(directory).expect("read source directory") {15
let path = entry.expect("directory entry").path();31
let path = entry.expect("directory entry").path();@@ -64,30 +80,31 @@ fn matcher_matches_allowlist_from_match_start() {64
80
65
#[test]81
#[test]66
fn negative_offsets_go_through_corner_badge() {82
fn negative_offsets_go_through_corner_badge() {67
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");68
let pattern = offset_pattern();83
let pattern = offset_pattern();69
let mut files = Vec::new();70
source_files(&root, &mut files);71
let mut matched_allowlist = HashSet::new();84
let mut matched_allowlist = HashSet::new();72
let mut violations = Vec::new();85
let mut violations = Vec::new();73
for file in files {86
for root in source_roots() {74
let relative = file87
let mut files = Vec::new();75
.strip_prefix(&root)88
source_files(&root, &mut files);76
.expect("inside src")89
for file in files {77
.to_string_lossy()90
let relative = file78
.replace('\\', "/");91
.strip_prefix(&root)79
if relative == WIDGETS_FILE || relative == "layout_guard.rs" {92
.expect("inside src")80
continue;93
.to_string_lossy()81
}94
.replace('\\', "/");82
let source = fs::read_to_string(&file).expect("read source file");95
if relative == WIDGETS_FILE || relative == "layout_guard.rs" {83
for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {96
continue;84
match position {97
}85
Some(position) => {98
let source = fs::read_to_string(&file).expect("read source file");86
matched_allowlist.insert(position);99
for (line_number, position, text) in negative_offsets(&pattern, &source, &relative) {100
match position {101
Some(position) => {102
matched_allowlist.insert(position);103
}104
None => violations.push(format!(105
"{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"106
)),87
}107
}88
None => violations.push(format!(89
"{relative}:{line_number}: negative absolute offset, use widgets::corner_badge: {text}"90
)),91
}108
}92
}109
}93
}110
}@@ -108,6 +125,32 @@ fn negative_offsets_go_through_corner_badge() {108
);125
);109
}126
}110
127
128
#[test]129
fn hover_styles_never_toggle_display() {130
let toggle =131
Regex::new(r"hover\([^|]*\|\w+\|\s*\w+\s*\.\s*(hidden|flex|block|grid)\(\)").unwrap();132
let mut files = Vec::new();133
for root in source_roots() {134
source_files(&root, &mut files);135
}136
let offenders: Vec<String> = files137
.iter()138
.flat_map(|path| {139
let source = fs::read_to_string(path).unwrap();140
source141
.lines()142
.enumerate()143
.filter(|(_, line)| toggle.is_match(line))144
.map(|(index, _)| format!("{}:{}", path.display(), index + 1))145
.collect::<Vec<_>>()146
})147
.collect();148
assert!(149
offenders.is_empty(),150
"hover styles must toggle visible()/invisible(), not display (gpui panics \"must call prepaint before paint\"): {offenders:?}"151
);152
}153
111
mod frames {154
mod frames {112
use std::collections::HashSet;155
use std::collections::HashSet;113
use std::sync::Arc;156
use std::sync::Arc;@@ -7,35 +7,19 @@ mod activity;
7
7
mod agent_api;
8
8
mod agents;
9
9
mod app_state;
10
mod assets;
11
mod avatar_image;
12
10
mod backend;
13
11
mod call;
14
12
mod card_actions;
15
13
mod card_inputs;
16
14
mod card_refresh;
17
15
mod card_state;
18
mod channel_files;
19
16
mod chat_actions;
20
mod crash_log;
21
17
mod data;
22
18
mod demo;
23
mod demo_cards;
24
mod demo_chart_cards;
25
mod demo_gifs;
26
mod demo_input_cards;
27
mod demo_library;
28
19
mod demo_profiles;
29
mod demo_recap;
30
mod diagnostics;
31
mod downloads;
32
20
mod emoji;
33
mod format;
34
mod frame_log;
35
mod fuzzy;
36
21
mod gifs;
37
22
mod image_view_gallery;
38
mod image_view_math;
39
23
#[cfg(test)]
40
24
mod layout_guard;
41
25
mod local_previews;
@@ -46,33 +30,28 @@ mod outbox;
46
30
mod own_status;
47
31
mod pending_rows;
48
32
mod people;
49
mod presence_link;
50
33
mod profile_model;
51
34
mod profile_state;
52
35
mod reaction_model;
53
mod read_state;
54
mod recap;
55
mod remote_image;
56
36
mod render;
57
37
mod rows;
58
mod runtime;
59
mod schedule_time;
60
38
mod scheduled;
61
39
mod scheduled_rows;
62
40
mod section_actions;
63
41
mod sidebar_model;
64
mod single_instance;
65
mod stickers;
66
42
mod stored_outgoing;
67
43
mod task_dialog;
68
mod theme;
69
mod translation;
70
44
mod translation_actions;
71
45
mod typing;
72
mod updater;
73
mod user_activity;
74
46
mod views;
75
47
48
pub use app_base::{
49
APP_NAME, assets, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,
50
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,
51
image_view_math, presence_link, read_state, recap, remote_image, runtime, schedule_time,
52
single_instance, stickers, theme, translation, updater, user_activity,
53
};
54
76
55
use std::path::PathBuf;
77
56
use std::sync::Arc;
78
57
use std::time::Duration;
@@ -85,7 +64,7 @@ use store::Store;
85
64
use app_state::{AppState, Mode};
86
65
use views::shell::{AppShell, OpenTarget, Startup, bind_keys};
87
66
88
pub const APP_NAME: &str = "Rusty Teams";
67
const VERSION_MARKER: &str = concat!("teams-build:", env!("TEAMS_BUILD_VERSION"));
89
68
const HTTP_USER_AGENT: &str = "teams-linux";
90
69
const WINDOW_WIDTH: f32 = 1240.;
91
70
const WINDOW_HEIGHT: f32 = 820.;
@@ -195,6 +174,7 @@ fn open_store(path: &std::path::Path) -> Store {
195
174
}
196
175
197
176
fn main() {
177
app_base::version::set_build_version(VERSION_MARKER.trim_start_matches("teams-build:"));
198
178
crash_log::install(data_path(crash_log::CRASH_LOG_FILE));
199
179
diagnostics::install(data_path(diagnostics::DIAGNOSTICS_FILE));
200
180
let arguments = parse_arguments();
@@ -7,35 +7,19 @@ mod activity;7
mod agent_api;7
mod agent_api;8
mod agents;8
mod agents;9
mod app_state;9
mod app_state;10
mod assets;11
mod avatar_image;12
mod backend;10
mod backend;13
mod call;11
mod call;14
mod card_actions;12
mod card_actions;15
mod card_inputs;13
mod card_inputs;16
mod card_refresh;14
mod card_refresh;17
mod card_state;15
mod card_state;18
mod channel_files;19
mod chat_actions;16
mod chat_actions;20
mod crash_log;21
mod data;17
mod data;22
mod demo;18
mod demo;23
mod demo_cards;24
mod demo_chart_cards;25
mod demo_gifs;26
mod demo_input_cards;27
mod demo_library;28
mod demo_profiles;19
mod demo_profiles;29
mod demo_recap;30
mod diagnostics;31
mod downloads;32
mod emoji;20
mod emoji;33
mod format;34
mod frame_log;35
mod fuzzy;36
mod gifs;21
mod gifs;37
mod image_view_gallery;22
mod image_view_gallery;38
mod image_view_math;39
#[cfg(test)]23
#[cfg(test)]40
mod layout_guard;24
mod layout_guard;41
mod local_previews;25
mod local_previews;@@ -46,33 +30,28 @@ mod outbox;46
mod own_status;30
mod own_status;47
mod pending_rows;31
mod pending_rows;48
mod people;32
mod people;49
mod presence_link;50
mod profile_model;33
mod profile_model;51
mod profile_state;34
mod profile_state;52
mod reaction_model;35
mod reaction_model;53
mod read_state;54
mod recap;55
mod remote_image;56
mod render;36
mod render;57
mod rows;37
mod rows;58
mod runtime;59
mod schedule_time;60
mod scheduled;38
mod scheduled;61
mod scheduled_rows;39
mod scheduled_rows;62
mod section_actions;40
mod section_actions;63
mod sidebar_model;41
mod sidebar_model;64
mod single_instance;65
mod stickers;66
mod stored_outgoing;42
mod stored_outgoing;67
mod task_dialog;43
mod task_dialog;68
mod theme;69
mod translation;70
mod translation_actions;44
mod translation_actions;71
mod typing;45
mod typing;72
mod updater;73
mod user_activity;74
mod views;46
mod views;75
47
48
pub use app_base::{49
APP_NAME, assets, avatar_image, channel_files, crash_log, demo_cards, demo_chart_cards, demo_gifs,50
demo_input_cards, demo_library, demo_recap, diagnostics, downloads, format, frame_log, fuzzy,51
image_view_math, presence_link, read_state, recap, remote_image, runtime, schedule_time,52
single_instance, stickers, theme, translation, updater, user_activity,53
};54
76
use std::path::PathBuf;55
use std::path::PathBuf;77
use std::sync::Arc;56
use std::sync::Arc;78
use std::time::Duration;57
use std::time::Duration;@@ -85,7 +64,7 @@ use store::Store;85
use app_state::{AppState, Mode};64
use app_state::{AppState, Mode};86
use views::shell::{AppShell, OpenTarget, Startup, bind_keys};65
use views::shell::{AppShell, OpenTarget, Startup, bind_keys};87
66
88
pub const APP_NAME: &str = "Rusty Teams";67
const VERSION_MARKER: &str = concat!("teams-build:", env!("TEAMS_BUILD_VERSION"));89
const HTTP_USER_AGENT: &str = "teams-linux";68
const HTTP_USER_AGENT: &str = "teams-linux";90
const WINDOW_WIDTH: f32 = 1240.;69
const WINDOW_WIDTH: f32 = 1240.;91
const WINDOW_HEIGHT: f32 = 820.;70
const WINDOW_HEIGHT: f32 = 820.;@@ -195,6 +174,7 @@ fn open_store(path: &std::path::Path) -> Store {195
}174
}196
175
197
fn main() {176
fn main() {177
app_base::version::set_build_version(VERSION_MARKER.trim_start_matches("teams-build:"));198
crash_log::install(data_path(crash_log::CRASH_LOG_FILE));178
crash_log::install(data_path(crash_log::CRASH_LOG_FILE));199
diagnostics::install(data_path(diagnostics::DIAGNOSTICS_FILE));179
diagnostics::install(data_path(diagnostics::DIAGNOSTICS_FILE));200
let arguments = parse_arguments();180
let arguments = parse_arguments();@@ -1,14 +1,8 @@
1
1
mod agent_toast;
2
#[cfg_attr(not(windows), allow(dead_code))]
3
mod badge;
4
2
mod center;
5
3
mod incoming;
6
4
mod layout;
7
5
mod meeting_view;
8
#[cfg_attr(not(windows), allow(dead_code))]
9
pub(crate) mod platform;
10
#[cfg_attr(not(windows), allow(dead_code))]
11
mod ring_tone;
12
6
mod ring_view;
13
7
mod rules;
14
8
mod settings;
@@ -18,6 +12,7 @@ mod stack;
18
12
mod text;
19
13
mod toast;
20
14
15
pub use app_base::notify::{badge, platform, ring_tone};
21
16
pub use center::{NotificationCenter, selection_for};
22
17
pub use incoming::{IncomingTracker, preview_of};
23
18
#[cfg(windows)]
@@ -1,14 +1,8 @@1
mod agent_toast;1
mod agent_toast;2
#[cfg_attr(not(windows), allow(dead_code))]3
mod badge;4
mod center;2
mod center;5
mod incoming;3
mod incoming;6
mod layout;4
mod layout;7
mod meeting_view;5
mod meeting_view;8
#[cfg_attr(not(windows), allow(dead_code))]9
pub(crate) mod platform;10
#[cfg_attr(not(windows), allow(dead_code))]11
mod ring_tone;12
mod ring_view;6
mod ring_view;13
mod rules;7
mod rules;14
mod settings;8
mod settings;@@ -18,6 +12,7 @@ mod stack;18
mod text;12
mod text;19
mod toast;13
mod toast;20
14
15
pub use app_base::notify::{badge, platform, ring_tone};21
pub use center::{NotificationCenter, selection_for};16
pub use center::{NotificationCenter, selection_for};22
pub use incoming::{IncomingTracker, preview_of};17
pub use incoming::{IncomingTracker, preview_of};23
#[cfg(windows)]18
#[cfg(windows)]@@ -7,8 +7,8 @@ use crate::card_state::CardScope;
7
7
8
8
#[cfg(windows)]
9
9
mod hosted;
10
#[cfg_attr(not(windows), allow(dead_code))]
11
mod sdk;
10
#[cfg(windows)]
11
use app_base::task_dialog::sdk;
12
12
13
13
#[cfg(windows)]
14
14
pub use hosted::install_host;
@@ -7,8 +7,8 @@ use crate::card_state::CardScope;7
7
8
#[cfg(windows)]8
#[cfg(windows)]9
mod hosted;9
mod hosted;10
#[cfg_attr(not(windows), allow(dead_code))]10
#[cfg(windows)]11
mod sdk;11
use app_base::task_dialog::sdk;12
12
13
#[cfg(windows)]13
#[cfg(windows)]14
pub use hosted::install_host;14
pub use hosted::install_host;@@ -72,47 +72,3 @@ pub mod toolbar_placement;
72
72
pub mod transfer_picker;
73
73
pub mod translation_line;
74
74
pub mod widgets;
75
76
#[cfg(test)]
77
mod tests {
78
use std::path::Path;
79
80
fn rust_files(directory: &Path, files: &mut Vec<std::path::PathBuf>) {
81
for entry in std::fs::read_dir(directory).unwrap() {
82
let path = entry.unwrap().path();
83
if path.is_dir() {
84
rust_files(&path, files);
85
} else if path.extension().is_some_and(|extension| extension == "rs") {
86
files.push(path);
87
}
88
}
89
}
90
91
#[test]
92
fn hover_styles_never_toggle_display() {
93
let toggle =
94
regex::Regex::new(r"hover\([^|]*\|\w+\|\s*\w+\s*\.\s*(hidden|flex|block|grid)\(\)")
95
.unwrap();
96
let mut files = Vec::new();
97
rust_files(
98
&Path::new(env!("CARGO_MANIFEST_DIR")).join("src"),
99
&mut files,
100
);
101
let offenders: Vec<String> = files
102
.iter()
103
.flat_map(|path| {
104
let source = std::fs::read_to_string(path).unwrap();
105
source
106
.lines()
107
.enumerate()
108
.filter(|(_, line)| toggle.is_match(line))
109
.map(|(index, _)| format!("{}:{}", path.display(), index + 1))
110
.collect::<Vec<_>>()
111
})
112
.collect();
113
assert!(
114
offenders.is_empty(),
115
"hover styles must toggle visible()/invisible(), not display (gpui panics \"must call prepaint before paint\"): {offenders:?}"
116
);
117
}
118
}
@@ -72,47 +72,3 @@ pub mod toolbar_placement;72
pub mod transfer_picker;72
pub mod transfer_picker;73
pub mod translation_line;73
pub mod translation_line;74
pub mod widgets;74
pub mod widgets;75
76
#[cfg(test)]77
mod tests {78
use std::path::Path;79
80
fn rust_files(directory: &Path, files: &mut Vec<std::path::PathBuf>) {81
for entry in std::fs::read_dir(directory).unwrap() {82
let path = entry.unwrap().path();83
if path.is_dir() {84
rust_files(&path, files);85
} else if path.extension().is_some_and(|extension| extension == "rs") {86
files.push(path);87
}88
}89
}90
91
#[test]92
fn hover_styles_never_toggle_display() {93
let toggle =94
regex::Regex::new(r"hover\([^|]*\|\w+\|\s*\w+\s*\.\s*(hidden|flex|block|grid)\(\)")95
.unwrap();96
let mut files = Vec::new();97
rust_files(98
&Path::new(env!("CARGO_MANIFEST_DIR")).join("src"),99
&mut files,100
);101
let offenders: Vec<String> = files102
.iter()103
.flat_map(|path| {104
let source = std::fs::read_to_string(path).unwrap();105
source106
.lines()107
.enumerate()108
.filter(|(_, line)| toggle.is_match(line))109
.map(|(index, _)| format!("{}:{}", path.display(), index + 1))110
.collect::<Vec<_>>()111
})112
.collect();113
assert!(114
offenders.is_empty(),115
"hover styles must toggle visible()/invisible(), not display (gpui panics \"must call prepaint before paint\"): {offenders:?}"116
);117
}118
}