onboarding: Remove feature flag and old welcome crate (#36110)

Release Notes:

- N/A

---------

Co-authored-by: MrSubidubi <dev@bahn.sh>
Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
Danilo Leal 2025-08-13 13:18:24 -03:00 committed by GitHub
parent a7442d8880
commit d9a94a5496
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 26 additions and 574 deletions

30
Cargo.lock generated
View file

@ -11152,12 +11152,10 @@ dependencies = [
"ai_onboarding",
"anyhow",
"client",
"command_palette_hooks",
"component",
"db",
"documented",
"editor",
"feature_flags",
"fs",
"fuzzy",
"git",
@ -18888,33 +18886,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "welcome"
version = "0.1.0"
dependencies = [
"anyhow",
"client",
"component",
"db",
"documented",
"editor",
"fuzzy",
"gpui",
"install_cli",
"language",
"picker",
"project",
"serde",
"settings",
"telemetry",
"ui",
"util",
"vim_mode_setting",
"workspace",
"workspace-hack",
"zed_actions",
]
[[package]]
name = "which"
version = "4.4.2"
@ -20669,7 +20640,6 @@ dependencies = [
"watch",
"web_search",
"web_search_providers",
"welcome",
"windows 0.61.1",
"winresource",
"workspace",

View file

@ -185,7 +185,6 @@ members = [
"crates/watch",
"crates/web_search",
"crates/web_search_providers",
"crates/welcome",
"crates/workspace",
"crates/worktree",
"crates/x_ai",
@ -412,7 +411,6 @@ vim_mode_setting = { path = "crates/vim_mode_setting" }
watch = { path = "crates/watch" }
web_search = { path = "crates/web_search" }
web_search_providers = { path = "crates/web_search_providers" }
welcome = { path = "crates/welcome" }
workspace = { path = "crates/workspace" }
worktree = { path = "crates/worktree" }
x_ai = { path = "crates/x_ai" }

View file

@ -18,12 +18,10 @@ default = []
ai_onboarding.workspace = true
anyhow.workspace = true
client.workspace = true
command_palette_hooks.workspace = true
component.workspace = true
db.workspace = true
documented.workspace = true
editor.workspace = true
feature_flags.workspace = true
fs.workspace = true
fuzzy.workspace = true
git.workspace = true

View file

@ -12,7 +12,7 @@ use util::ResultExt;
use workspace::{ModalView, Workspace, ui::HighlightedLabel};
actions!(
welcome,
zed,
[
/// Toggles the base keymap selector modal.
ToggleBaseKeymapSelector

View file

@ -1,8 +1,7 @@
use crate::welcome::{ShowWelcome, WelcomePage};
pub use crate::welcome::ShowWelcome;
use crate::{multibuffer_hint::MultibufferHint, welcome::WelcomePage};
use client::{Client, UserStore, zed_urls};
use command_palette_hooks::CommandPaletteFilter;
use db::kvp::KEY_VALUE_STORE;
use feature_flags::{FeatureFlag, FeatureFlagViewExt as _};
use fs::Fs;
use gpui::{
Action, AnyElement, App, AppContext, AsyncWindowContext, Context, Entity, EventEmitter,
@ -27,17 +26,13 @@ use workspace::{
};
mod ai_setup_page;
mod base_keymap_picker;
mod basics_page;
mod editing_page;
pub mod multibuffer_hint;
mod theme_preview;
mod welcome;
pub struct OnBoardingFeatureFlag {}
impl FeatureFlag for OnBoardingFeatureFlag {
const NAME: &'static str = "onboarding";
}
/// Imports settings from Visual Studio Code.
#[derive(Copy, Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)]
@ -57,6 +52,7 @@ pub struct ImportCursorSettings {
}
pub const FIRST_OPEN: &str = "first_open";
pub const DOCS_URL: &str = "https://zed.dev/docs/";
actions!(
zed,
@ -80,11 +76,19 @@ actions!(
/// Sign in while in the onboarding flow.
SignIn,
/// Open the user account in zed.dev while in the onboarding flow.
OpenAccount
OpenAccount,
/// Resets the welcome screen hints to their initial state.
ResetHints
]
);
pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _cx| {
workspace
.register_action(|_workspace, _: &ResetHints, _, cx| MultibufferHint::set_count(0, cx));
})
.detach();
cx.on_action(|_: &OpenOnboarding, cx| {
with_active_or_new_workspace(cx, |workspace, window, cx| {
workspace
@ -182,34 +186,8 @@ pub fn init(cx: &mut App) {
})
.detach();
cx.observe_new::<Workspace>(|_, window, cx| {
let Some(window) = window else {
return;
};
base_keymap_picker::init(cx);
let onboarding_actions = [
std::any::TypeId::of::<OpenOnboarding>(),
std::any::TypeId::of::<ShowWelcome>(),
];
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_action_types(&onboarding_actions);
});
cx.observe_flag::<OnBoardingFeatureFlag, _>(window, move |is_enabled, _, _, cx| {
if is_enabled {
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.show_action_types(onboarding_actions.iter());
});
} else {
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_action_types(&onboarding_actions);
});
}
})
.detach();
})
.detach();
register_serializable_item::<Onboarding>(cx);
}

View file

@ -1,40 +0,0 @@
[package]
name = "welcome"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "src/welcome.rs"
[features]
test-support = []
[dependencies]
anyhow.workspace = true
client.workspace = true
component.workspace = true
db.workspace = true
documented.workspace = true
fuzzy.workspace = true
gpui.workspace = true
install_cli.workspace = true
language.workspace = true
picker.workspace = true
project.workspace = true
serde.workspace = true
settings.workspace = true
telemetry.workspace = true
ui.workspace = true
util.workspace = true
vim_mode_setting.workspace = true
workspace-hack.workspace = true
workspace.workspace = true
zed_actions.workspace = true
[dev-dependencies]
editor = { workspace = true, features = ["test-support"] }

View file

@ -1 +0,0 @@
../../LICENSE-GPL

View file

@ -1,446 +0,0 @@
use client::{TelemetrySettings, telemetry::Telemetry};
use db::kvp::KEY_VALUE_STORE;
use gpui::{
Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, actions, svg,
};
use language::language_settings::{EditPredictionProvider, all_language_settings};
use project::DisableAiSettings;
use settings::{Settings, SettingsStore};
use std::sync::Arc;
use ui::{CheckboxWithLabel, ElevationIndex, Tooltip, prelude::*};
use util::ResultExt;
use vim_mode_setting::VimModeSetting;
use workspace::{
AppState, Welcome, Workspace, WorkspaceId,
dock::DockPosition,
item::{Item, ItemEvent},
open_new,
};
pub use multibuffer_hint::*;
mod base_keymap_picker;
mod multibuffer_hint;
actions!(
welcome,
[
/// Resets the welcome screen hints to their initial state.
ResetHints
]
);
pub const FIRST_OPEN: &str = "first_open";
pub const DOCS_URL: &str = "https://zed.dev/docs/";
pub fn init(cx: &mut App) {
cx.observe_new(|workspace: &mut Workspace, _, _cx| {
workspace.register_action(|workspace, _: &Welcome, window, cx| {
let welcome_page = WelcomePage::new(workspace, cx);
workspace.add_item_to_active_pane(Box::new(welcome_page), None, true, window, cx)
});
workspace
.register_action(|_workspace, _: &ResetHints, _, cx| MultibufferHint::set_count(0, cx));
})
.detach();
base_keymap_picker::init(cx);
}
pub fn show_welcome_view(app_state: Arc<AppState>, cx: &mut App) -> Task<anyhow::Result<()>> {
open_new(
Default::default(),
app_state,
cx,
|workspace, window, cx| {
workspace.toggle_dock(DockPosition::Left, window, cx);
let welcome_page = WelcomePage::new(workspace, cx);
workspace.add_item_to_center(Box::new(welcome_page.clone()), window, cx);
window.focus(&welcome_page.focus_handle(cx));
cx.notify();
db::write_and_log(cx, || {
KEY_VALUE_STORE.write_kvp(FIRST_OPEN.to_string(), "false".to_string())
});
},
)
}
pub struct WelcomePage {
workspace: WeakEntity<Workspace>,
focus_handle: FocusHandle,
telemetry: Arc<Telemetry>,
_settings_subscription: Subscription,
}
impl Render for WelcomePage {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let edit_prediction_provider_is_zed =
all_language_settings(None, cx).edit_predictions.provider
== EditPredictionProvider::Zed;
let edit_prediction_label = if edit_prediction_provider_is_zed {
"Edit Prediction Enabled"
} else {
"Try Edit Prediction"
};
h_flex()
.size_full()
.bg(cx.theme().colors().editor_background)
.key_context("Welcome")
.track_focus(&self.focus_handle(cx))
.child(
v_flex()
.gap_8()
.mx_auto()
.child(
v_flex()
.w_full()
.child(
svg()
.path("icons/logo_96.svg")
.text_color(cx.theme().colors().icon_disabled)
.w(px(40.))
.h(px(40.))
.mx_auto()
.mb_4(),
)
.child(
h_flex()
.w_full()
.justify_center()
.child(Headline::new("Welcome to Zed")),
)
.child(
h_flex().w_full().justify_center().child(
Label::new("The editor for what's next")
.color(Color::Muted)
.italic(),
),
),
)
.child(
h_flex()
.items_start()
.gap_8()
.child(
v_flex()
.gap_2()
.pr_8()
.border_r_1()
.border_color(cx.theme().colors().border_variant)
.child(
self.section_label( cx).child(
Label::new("Get Started")
.size(LabelSize::XSmall)
.color(Color::Muted),
),
)
.child(
Button::new("choose-theme", "Choose a Theme")
.icon(IconName::SwatchBook)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
telemetry::event!("Welcome Theme Changed");
this.workspace
.update(cx, |_workspace, cx| {
window.dispatch_action(zed_actions::theme_selector::Toggle::default().boxed_clone(), cx);
})
.ok();
})),
)
.child(
Button::new("choose-keymap", "Choose a Keymap")
.icon(IconName::Keyboard)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
telemetry::event!("Welcome Keymap Changed");
this.workspace
.update(cx, |workspace, cx| {
base_keymap_picker::toggle(
workspace,
&Default::default(),
window, cx,
)
})
.ok();
})),
)
.when(!DisableAiSettings::get_global(cx).disable_ai, |parent| {
parent.child(
Button::new(
"edit_prediction_onboarding",
edit_prediction_label,
)
.disabled(edit_prediction_provider_is_zed)
.icon(IconName::ZedPredict)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(
cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Screen Try Edit Prediction clicked");
window.dispatch_action(zed_actions::OpenZedPredictOnboarding.boxed_clone(), cx);
}),
),
)
})
.child(
Button::new("edit settings", "Edit Settings")
.icon(IconName::Settings)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Settings Edited");
window.dispatch_action(Box::new(
zed_actions::OpenSettings,
), cx);
})),
)
)
.child(
v_flex()
.gap_2()
.child(
self.section_label(cx).child(
Label::new("Resources")
.size(LabelSize::XSmall)
.color(Color::Muted),
),
)
.when(cfg!(target_os = "macos"), |el| {
el.child(
Button::new("install-cli", "Install the CLI")
.icon(IconName::Terminal)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|this, _, window, cx| {
telemetry::event!("Welcome CLI Installed");
this.workspace.update(cx, |_, cx|{
install_cli::install_cli(window, cx);
}).log_err();
})),
)
})
.child(
Button::new("view-docs", "View Documentation")
.icon(IconName::FileCode)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|_, _, _, cx| {
telemetry::event!("Welcome Documentation Viewed");
cx.open_url(DOCS_URL);
})),
)
.child(
Button::new("explore-extensions", "Explore Extensions")
.icon(IconName::Blocks)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.icon_position(IconPosition::Start)
.on_click(cx.listener(|_, _, window, cx| {
telemetry::event!("Welcome Extensions Page Opened");
window.dispatch_action(Box::new(
zed_actions::Extensions::default(),
), cx);
})),
)
),
)
.child(
v_container()
.px_2()
.gap_2()
.child(
h_flex()
.justify_between()
.child(
CheckboxWithLabel::new(
"enable-vim",
Label::new("Enable Vim Mode"),
if VimModeSetting::get_global(cx).0 {
ui::ToggleState::Selected
} else {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
telemetry::event!("Welcome Vim Mode Toggled");
this.update_settings::<VimModeSetting>(
selection,
cx,
|setting, value| *setting = Some(value),
);
}),
)
.fill()
.elevation(ElevationIndex::ElevatedSurface),
)
.child(
IconButton::new("vim-mode", IconName::Info)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.tooltip(
Tooltip::text(
"You can also toggle Vim Mode via the command palette or Editor Controls menu.")
),
),
)
.child(
CheckboxWithLabel::new(
"enable-crash",
Label::new("Send Crash Reports"),
if TelemetrySettings::get_global(cx).diagnostics {
ui::ToggleState::Selected
} else {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
telemetry::event!("Welcome Diagnostic Telemetry Toggled");
this.update_settings::<TelemetrySettings>(selection, cx, {
move |settings, value| {
settings.diagnostics = Some(value);
telemetry::event!(
"Settings Changed",
setting = "diagnostic telemetry",
value
);
}
});
}),
)
.fill()
.elevation(ElevationIndex::ElevatedSurface),
)
.child(
CheckboxWithLabel::new(
"enable-telemetry",
Label::new("Send Telemetry"),
if TelemetrySettings::get_global(cx).metrics {
ui::ToggleState::Selected
} else {
ui::ToggleState::Unselected
},
cx.listener(move |this, selection, _window, cx| {
telemetry::event!("Welcome Metric Telemetry Toggled");
this.update_settings::<TelemetrySettings>(selection, cx, {
move |settings, value| {
settings.metrics = Some(value);
telemetry::event!(
"Settings Changed",
setting = "metric telemetry",
value
);
}
});
}),
)
.fill()
.elevation(ElevationIndex::ElevatedSurface),
),
),
)
}
}
impl WelcomePage {
pub fn new(workspace: &Workspace, cx: &mut Context<Workspace>) -> Entity<Self> {
let this = cx.new(|cx| {
cx.on_release(|_: &mut Self, _| {
telemetry::event!("Welcome Page Closed");
})
.detach();
WelcomePage {
focus_handle: cx.focus_handle(),
workspace: workspace.weak_handle(),
telemetry: workspace.client().telemetry().clone(),
_settings_subscription: cx
.observe_global::<SettingsStore>(move |_, cx| cx.notify()),
}
});
this
}
fn section_label(&self, cx: &mut App) -> Div {
div()
.pl_1()
.font_buffer(cx)
.text_color(Color::Muted.color(cx))
}
fn update_settings<T: Settings>(
&mut self,
selection: &ToggleState,
cx: &mut Context<Self>,
callback: impl 'static + Send + Fn(&mut T::FileContent, bool),
) {
if let Some(workspace) = self.workspace.upgrade() {
let fs = workspace.read(cx).app_state().fs.clone();
let selection = *selection;
settings::update_settings_file::<T>(fs, cx, move |settings, _| {
let value = match selection {
ToggleState::Unselected => false,
ToggleState::Selected => true,
_ => return,
};
callback(settings, value)
});
}
}
}
impl EventEmitter<ItemEvent> for WelcomePage {}
impl Focusable for WelcomePage {
fn focus_handle(&self, _: &App) -> gpui::FocusHandle {
self.focus_handle.clone()
}
}
impl Item for WelcomePage {
type Event = ItemEvent;
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
"Welcome".into()
}
fn telemetry_event_text(&self) -> Option<&'static str> {
Some("Welcome Page Opened")
}
fn show_toolbar(&self) -> bool {
false
}
fn clone_on_split(
&self,
_workspace_id: Option<WorkspaceId>,
_: &mut Window,
cx: &mut Context<Self>,
) -> Option<Entity<Self>> {
Some(cx.new(|cx| WelcomePage {
focus_handle: cx.focus_handle(),
workspace: self.workspace.clone(),
telemetry: self.telemetry.clone(),
_settings_subscription: cx.observe_global::<SettingsStore>(move |_, cx| cx.notify()),
}))
}
fn to_item_events(event: &Self::Event, mut f: impl FnMut(workspace::item::ItemEvent)) {
f(*event)
}
}

View file

@ -248,8 +248,6 @@ actions!(
ToggleZoom,
/// Stops following a collaborator.
Unfollow,
/// Shows the welcome screen.
Welcome,
/// Restores the banner.
RestoreBanner,
/// Toggles expansion of the selected item.

View file

@ -157,7 +157,6 @@ vim_mode_setting.workspace = true
watch.workspace = true
web_search.workspace = true
web_search_providers.workspace = true
welcome.workspace = true
workspace-hack.workspace = true
workspace.workspace = true
zed_actions.workspace = true

View file

@ -20,6 +20,7 @@ use gpui::{App, AppContext as _, Application, AsyncApp, Focusable as _, UpdateGl
use gpui_tokio::Tokio;
use http_client::{Url, read_proxy_from_env};
use language::LanguageRegistry;
use onboarding::{FIRST_OPEN, show_onboarding_view};
use prompt_store::PromptBuilder;
use reqwest_client::ReqwestClient;
@ -44,7 +45,6 @@ use theme::{
};
use util::{ResultExt, TryFutureExt, maybe};
use uuid::Uuid;
use welcome::{FIRST_OPEN, show_welcome_view};
use workspace::{
AppState, SerializedWorkspaceLocation, Toast, Workspace, WorkspaceSettings, WorkspaceStore,
notifications::NotificationId,
@ -623,7 +623,6 @@ pub fn main() {
feedback::init(cx);
markdown_preview::init(cx);
svg_preview::init(cx);
welcome::init(cx);
onboarding::init(cx);
settings_ui::init(cx);
extensions_ui::init(cx);
@ -1044,7 +1043,7 @@ async fn restore_or_create_workspace(app_state: Arc<AppState>, cx: &mut AsyncApp
}
}
} else if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
cx.update(|cx| show_welcome_view(app_state, cx))?.await?;
cx.update(|cx| show_onboarding_view(app_state, cx))?.await?;
} else {
cx.update(|cx| {
workspace::open_new(

View file

@ -34,6 +34,8 @@ use image_viewer::ImageInfo;
use language_tools::lsp_tool::{self, LspTool};
use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationType};
use migrator::{migrate_keymap, migrate_settings};
use onboarding::DOCS_URL;
use onboarding::multibuffer_hint::MultibufferHint;
pub use open_listener::*;
use outline_panel::OutlinePanel;
use paths::{
@ -67,7 +69,6 @@ use util::markdown::MarkdownString;
use util::{ResultExt, asset_str};
use uuid::Uuid;
use vim_mode_setting::VimModeSetting;
use welcome::{DOCS_URL, MultibufferHint};
use workspace::notifications::{NotificationId, dismiss_app_notification, show_app_notification};
use workspace::{
AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings,
@ -3975,7 +3976,6 @@ mod tests {
client::init(&app_state.client, cx);
language::init(cx);
workspace::init(app_state.clone(), cx);
welcome::init(cx);
onboarding::init(cx);
Project::init_settings(cx);
app_state
@ -4380,7 +4380,6 @@ mod tests {
"toolchain",
"variable_list",
"vim",
"welcome",
"workspace",
"zed",
"zed_predict_onboarding",

View file

@ -249,7 +249,7 @@ pub fn app_menus() -> Vec<Menu> {
),
MenuItem::action("View Telemetry", zed_actions::OpenTelemetryLog),
MenuItem::action("View Dependency Licenses", zed_actions::OpenLicenses),
MenuItem::action("Show Welcome", workspace::Welcome),
MenuItem::action("Show Welcome", onboarding::ShowWelcome),
MenuItem::action("Give Feedback...", zed_actions::feedback::GiveFeedback),
MenuItem::separator(),
MenuItem::action(

View file

@ -15,6 +15,8 @@ use futures::{FutureExt, SinkExt, StreamExt};
use git_ui::file_diff_view::FileDiffView;
use gpui::{App, AsyncApp, Global, WindowHandle};
use language::Point;
use onboarding::FIRST_OPEN;
use onboarding::show_onboarding_view;
use recent_projects::{SshSettings, open_ssh_project};
use remote::SshConnectionOptions;
use settings::Settings;
@ -24,7 +26,6 @@ use std::thread;
use std::time::Duration;
use util::ResultExt;
use util::paths::PathWithPosition;
use welcome::{FIRST_OPEN, show_welcome_view};
use workspace::item::ItemHandle;
use workspace::{AppState, OpenOptions, SerializedWorkspaceLocation, Workspace};
@ -378,7 +379,7 @@ async fn open_workspaces(
if grouped_locations.is_empty() {
// If we have no paths to open, show the welcome screen if this is the first launch
if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
cx.update(|cx| show_welcome_view(app_state, cx).detach())
cx.update(|cx| show_onboarding_view(app_state, cx).detach())
.log_err();
}
// If not the first launch, show an empty window with empty editor

View file

@ -4,7 +4,8 @@ Zed collects anonymous telemetry data to help the team understand how people are
## Configuring Telemetry Settings
You have full control over what data is sent out by Zed. To enable or disable some or all telemetry types, open your `settings.json` file via {#action zed::OpenSettings}({#kb zed::OpenSettings}) from the command palette.
You have full control over what data is sent out by Zed.
To enable or disable some or all telemetry types, open your `settings.json` file via {#action zed::OpenSettings}({#kb zed::OpenSettings}) from the command palette.
Insert and tweak the following:
@ -15,8 +16,6 @@ Insert and tweak the following:
},
```
The telemetry settings can also be configured via the welcome screen, which can be invoked via the {#action workspace::Welcome} action in the command palette.
## Dataflow
Telemetry is sent from the application to our servers. Data is proxied through our servers to enable us to easily switch analytics services. We currently use: