Kirill BulatovAdd LSP logs clear button7b5974e3 years agoHistory
1265 lines · 35.8 KB · Rust
RawDownload
pub mod components;mod theme_registry;mod theme_settings;pub mod ui; use components::{action_button::ButtonStyle, disclosure::DisclosureStyle, ToggleIconButtonStyle};use gpui::{    color::Color,    elements::{ContainerStyle, ImageStyle, LabelStyle, Shadow, SvgStyle, TooltipStyle},    fonts::{HighlightStyle, TextStyle},    platform, AppContext, AssetSource, Border, MouseState,};use schemars::JsonSchema;use serde::{de::DeserializeOwned, Deserialize};use serde_json::Value;use settings::SettingsStore;use std::{collections::HashMap, ops::Deref, sync::Arc};use ui::{CheckboxStyle, CopilotCTAButton, IconStyle, ModalStyle}; pub use theme_registry::*;pub use theme_settings::*; pub fn current(cx: &AppContext) -> Arc<Theme> {    settings::get::<ThemeSettings>(cx).theme.clone()} pub fn init(source: impl AssetSource, cx: &mut AppContext) {    cx.set_global(ThemeRegistry::new(source, cx.font_cache().clone()));    settings::register::<ThemeSettings>(cx);     let mut prev_buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;    cx.observe_global::<SettingsStore, _>(move |cx| {        let buffer_font_size = settings::get::<ThemeSettings>(cx).buffer_font_size;        if buffer_font_size != prev_buffer_font_size {            prev_buffer_font_size = buffer_font_size;            reset_font_size(cx);        }    })    .detach();} #[derive(Deserialize, Default, JsonSchema)]pub struct Theme {    #[serde(default)]    pub meta: ThemeMeta,    pub workspace: Workspace,    pub context_menu: ContextMenu,    pub toolbar_dropdown_menu: DropdownMenu,    pub copilot: Copilot,    pub collab_panel: CollabPanel,    pub project_panel: ProjectPanel,    pub command_palette: CommandPalette,    pub picker: Picker,    pub editor: Editor,    pub search: Search,    pub project_diagnostics: ProjectDiagnostics,    pub shared_screen: ContainerStyle,    pub contact_notification: ContactNotification,    pub update_notification: UpdateNotification,    pub simple_message_notification: MessageNotification,    pub project_shared_notification: ProjectSharedNotification,    pub incoming_call_notification: IncomingCallNotification,    pub tooltip: TooltipStyle,    pub terminal: TerminalStyle,    pub assistant: AssistantStyle,    pub feedback: FeedbackStyle,    pub welcome: WelcomeStyle,    pub titlebar: Titlebar,    pub component_test: ComponentTest,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct ThemeMeta {    #[serde(skip_deserializing)]    pub id: usize,    pub name: String,    pub is_light: bool,} #[derive(Deserialize, Default, JsonSchema)]pub struct Workspace {    pub background: Color,    pub blank_pane: BlankPaneStyle,    pub tab_bar: TabBar,    pub pane_divider: Border,    pub leader_border_opacity: f32,    pub leader_border_width: f32,    pub dock: Dock,    pub status_bar: StatusBar,    pub toolbar: Toolbar,    pub disconnected_overlay: ContainedText,    pub modal: ContainerStyle,    pub zoomed_panel_foreground: ContainerStyle,    pub zoomed_pane_foreground: ContainerStyle,    pub zoomed_background: ContainerStyle,    pub notification: ContainerStyle,    pub notifications: Notifications,    pub joining_project_avatar: ImageStyle,    pub joining_project_message: ContainedText,    pub external_location_message: ContainedText,    pub drop_target_overlay_color: Color,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct BlankPaneStyle {    pub logo: SvgStyle,    pub logo_shadow: SvgStyle,    pub logo_container: ContainerStyle,    pub keyboard_hints: ContainerStyle,    pub keyboard_hint: Interactive<ContainedText>,    pub keyboard_hint_width: f32,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct Titlebar {    #[serde(flatten)]    pub container: ContainerStyle,    pub height: f32,    pub menu: TitlebarMenu,    pub project_menu_button: Toggleable<Interactive<ContainedText>>,    pub git_menu_button: Toggleable<Interactive<ContainedText>>,    pub item_spacing: f32,    pub face_pile_spacing: f32,    pub avatar_ribbon: AvatarRibbon,    pub follower_avatar_overlap: f32,    pub leader_selection: ContainerStyle,    pub offline_icon: OfflineIcon,    pub leader_avatar: AvatarStyle,    pub follower_avatar: AvatarStyle,    pub inactive_avatar_grayscale: bool,    pub sign_in_button: Toggleable<Interactive<ContainedText>>,    pub outdated_warning: ContainedText,    pub share_button: Toggleable<Interactive<ContainedText>>,    pub muted: Color,    pub speaking: Color,    pub screen_share_button: Toggleable<Interactive<IconButton>>,    pub toggle_contacts_button: Toggleable<Interactive<IconButton>>,    pub toggle_microphone_button: Toggleable<Interactive<IconButton>>,    pub toggle_speakers_button: Toggleable<Interactive<IconButton>>,    pub leave_call_button: Interactive<IconButton>,    pub toggle_contacts_badge: ContainerStyle,    pub user_menu: UserMenu,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct TitlebarMenu {    pub width: f32,    pub height: f32,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct UserMenu {    pub user_menu_button_online: UserMenuButton,    pub user_menu_button_offline: UserMenuButton,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct UserMenuButton {    pub user_menu: Toggleable<Interactive<Icon>>,    pub avatar: AvatarStyle,    pub icon: Icon,} #[derive(Copy, Clone, Deserialize, Default, JsonSchema)]pub struct AvatarStyle {    #[serde(flatten)]    pub image: ImageStyle,    pub outer_width: f32,    pub outer_corner_radius: f32,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct Copilot {    pub out_link_icon: Interactive<IconStyle>,    pub modal: ModalStyle,    pub auth: CopilotAuth,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct CopilotAuth {    pub content_width: f32,    pub prompting: CopilotAuthPrompting,    pub not_authorized: CopilotAuthNotAuthorized,    pub authorized: CopilotAuthAuthorized,    pub cta_button: CopilotCTAButton,    pub header: IconStyle,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct CopilotAuthPrompting {    pub subheading: ContainedText,    pub hint: ContainedText,    pub device_code: DeviceCode,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct DeviceCode {    pub text: TextStyle,    pub cta: CopilotCTAButton,    pub left: f32,    pub left_container: ContainerStyle,    pub right: f32,    pub right_container: Interactive<ContainerStyle>,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct CopilotAuthNotAuthorized {    pub subheading: ContainedText,    pub warning: ContainedText,} #[derive(Deserialize, Default, Clone, JsonSchema)]pub struct CopilotAuthAuthorized {    pub subheading: ContainedText,    pub hint: ContainedText,} #[derive(Deserialize, Default, JsonSchema)]pub struct CollabPanel {    #[serde(flatten)]    pub container: ContainerStyle,    pub disclosure: DisclosureStyle<()>,    pub list_empty_state: Toggleable<Interactive<ContainedText>>,    pub list_empty_icon: Icon,    pub list_empty_label_container: ContainerStyle,    pub log_in_button: Interactive<ContainedText>,    pub channel_editor: ContainerStyle,    pub channel_hash: Icon,    pub tabbed_modal: TabbedModal,    pub contact_finder: ContactFinder,    pub channel_modal: ChannelModal,    pub user_query_editor: FieldEditor,    pub user_query_editor_height: f32,    pub leave_call_button: Toggleable<Interactive<IconButton>>,    pub add_contact_button: Toggleable<Interactive<IconButton>>,    pub add_channel_button: Toggleable<Interactive<IconButton>>,    pub header_row: ContainedText,    pub subheader_row: Toggleable<Interactive<ContainedText>>,    pub leave_call: Interactive<ContainedText>,    pub contact_row: Toggleable<Interactive<ContainerStyle>>,    pub channel_row: Toggleable<Interactive<ContainerStyle>>,    pub channel_name: ContainedText,    pub row_height: f32,    pub project_row: Toggleable<Interactive<ProjectRow>>,    pub tree_branch: Toggleable<Interactive<TreeBranch>>,    pub contact_avatar: ImageStyle,    pub channel_avatar: ImageStyle,    pub extra_participant_label: ContainedText,    pub contact_status_free: ContainerStyle,    pub contact_status_busy: ContainerStyle,    pub contact_username: ContainedText,    pub contact_button: Interactive<IconButton>,    pub contact_button_spacing: f32,    pub channel_indent: f32,    pub disabled_button: IconButton,    pub section_icon_size: f32,    pub calling_indicator: ContainedText,    pub face_overlap: f32,} #[derive(Deserialize, Default, JsonSchema)]pub struct ComponentTest {    pub button: Interactive<ButtonStyle<TextStyle>>,    pub toggle: Toggleable<Interactive<ButtonStyle<TextStyle>>>,    pub disclosure: DisclosureStyle<TextStyle>,} #[derive(Deserialize, Default, JsonSchema)]pub struct TabbedModal {    pub tab_button: Toggleable<Interactive<ContainedText>>,    pub modal: ContainerStyle,    pub header: ContainerStyle,    pub body: ContainerStyle,    pub title: ContainedText,    pub picker: Picker,    pub max_height: f32,    pub max_width: f32,    pub row_height: f32,} #[derive(Deserialize, Default, JsonSchema)]pub struct ChannelModal {    pub contact_avatar: ImageStyle,    pub contact_username: ContainerStyle,    pub remove_member_button: ContainedText,    pub cancel_invite_button: ContainedText,    pub member_icon: IconButton,    pub invitee_icon: IconButton,    pub member_tag: ContainedText,} #[derive(Deserialize, Default, JsonSchema)]pub struct ProjectRow {    #[serde(flatten)]    pub container: ContainerStyle,    pub icon: Icon,    pub name: ContainedText,} #[derive(Deserialize, Default, Clone, Copy, JsonSchema)]pub struct TreeBranch {    pub width: f32,    pub color: Color,} #[derive(Deserialize, Default, JsonSchema)]pub struct ContactFinder {    pub contact_avatar: ImageStyle,    pub contact_username: ContainerStyle,    pub contact_button: IconButton,    pub disabled_contact_button: IconButton,} #[derive(Deserialize, Default, JsonSchema)]pub struct DropdownMenu {    #[serde(flatten)]    pub container: ContainerStyle,    pub header: Interactive<DropdownMenuItem>,    pub section_header: ContainedText,    pub item: Toggleable<Interactive<DropdownMenuItem>>,    pub row_height: f32,} #[derive(Deserialize, Default, JsonSchema)]pub struct DropdownMenuItem {    #[serde(flatten)]    pub container: ContainerStyle,    #[serde(flatten)]    pub text: TextStyle,    pub secondary_text: Option<TextStyle>,    #[serde(default)]    pub secondary_text_spacing: f32,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct TabBar {    #[serde(flatten)]    pub container: ContainerStyle,    pub pane_button: Toggleable<Interactive<IconButton>>,    pub pane_button_container: ContainerStyle,    pub active_pane: TabStyles,    pub inactive_pane: TabStyles,    pub dragged_tab: Tab,    pub height: f32,    pub nav_button: Interactive<IconButton>,} impl TabBar {    pub fn tab_style(&self, pane_active: bool, tab_active: bool) -> &Tab {        let tabs = if pane_active {            &self.active_pane        } else {            &self.inactive_pane        };         if tab_active {            &tabs.active_tab        } else {            &tabs.inactive_tab        }    }} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct TabStyles {    pub active_tab: Tab,    pub inactive_tab: Tab,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct AvatarRibbon {    #[serde(flatten)]    pub container: ContainerStyle,    pub width: f32,    pub height: f32,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct OfflineIcon {    #[serde(flatten)]    pub container: ContainerStyle,    pub width: f32,    pub color: Color,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct Tab {    pub height: f32,    #[serde(flatten)]    pub container: ContainerStyle,    #[serde(flatten)]    pub label: LabelStyle,    pub description: ContainedText,    pub spacing: f32,    pub close_icon_width: f32,    pub type_icon_width: f32,    pub icon_close: Color,    pub icon_close_active: Color,    pub icon_dirty: Color,    pub icon_conflict: Color,    pub git: GitProjectStatus,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct Toolbar {    #[serde(flatten)]    pub container: ContainerStyle,    pub height: f32,    pub item_spacing: f32,    pub toggleable_tool: Toggleable<Interactive<IconButton>>,    pub toggleable_text_tool: Toggleable<Interactive<ContainedText>>,    pub breadcrumb_height: f32,    pub breadcrumbs: Interactive<ContainedText>,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct Notifications {    #[serde(flatten)]    pub container: ContainerStyle,    pub width: f32,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct Search {    #[serde(flatten)]    pub container: ContainerStyle,    pub editor: FindEditor,    pub invalid_editor: ContainerStyle,    pub option_button_group: ContainerStyle,    pub include_exclude_editor: FindEditor,    pub invalid_include_exclude_editor: ContainerStyle,    pub include_exclude_inputs: ContainedText,    pub option_button: Toggleable<Interactive<IconButton>>,    pub option_button_component: ToggleIconButtonStyle,    pub action_button: Toggleable<Interactive<ContainedText>>,    pub match_background: Color,    pub match_index: ContainedText,    pub major_results_status: TextStyle,    pub minor_results_status: TextStyle,    pub editor_icon: IconStyle,    pub mode_button: Toggleable<Interactive<ContainedText>>,    pub nav_button: Toggleable<Interactive<ContainedLabel>>,    pub search_bar_row_height: f32,    pub search_row_spacing: f32,    pub option_button_height: f32,    pub modes_container: ContainerStyle,} #[derive(Clone, Deserialize, Default, JsonSchema)]pub struct FindEditor {    #[serde(flatten)]    pub input: FieldEditor,    pub min_width: f32,    pub max_width: f32,} #[derive(Deserialize, Default, JsonSchema)]pub struct StatusBar {    #[serde(flatten)]    pub container: ContainerStyle,    pub height: f32,    pub item_spacing: f32,    pub cursor_position: TextStyle,    pub vim_mode_indicator: ContainedText,    pub active_language: Interactive<ContainedText>,    pub auto_update_progress_message: TextStyle,    pub auto_update_done_message: TextStyle,    pub lsp_status: Interactive<StatusBarLspStatus>,    pub panel_buttons: StatusBarPanelButtons,    pub diagnostic_summary: Interactive<StatusBarDiagnosticSummary>,    pub diagnostic_message: Interactive<ContainedText>,} #[derive(Deserialize, Default, JsonSchema)]pub struct StatusBarPanelButtons {    pub group_left: ContainerStyle,    pub group_bottom: ContainerStyle,    pub group_right: ContainerStyle,    pub button: Toggleable<Interactive<PanelButton>>,} #[derive(Deserialize, Default, JsonSchema)]pub struct StatusBarDiagnosticSummary {    pub container_ok: ContainerStyle,    pub container_warning: ContainerStyle,    pub container_error: ContainerStyle,    pub text: TextStyle,    pub icon_color_ok: Color,    pub icon_color_warning: Color,    pub icon_color_error: Color,    pub height: f32,    pub icon_width: f32,    pub icon_spacing: f32,    pub summary_spacing: f32,} #[derive(Deserialize, Default, JsonSchema)]pub struct StatusBarLspStatus {    #[serde(flatten)]    pub container: ContainerStyle,

Lines 1–500 of 1265.