debugger: Change console text color, add tooltips (#31765)
- Improved legibility of console text: | Theme | Dark | Light | |--------|--------|--------| | Before |  |  | | After |  |  | Release Notes: - debugger: Improved legibility of console text - debugger: Added tooltips to all debugger items.
This commit is contained in:
parent
f8097c7c98
commit
ca6fd101c1
3 changed files with 39 additions and 8 deletions
|
@ -61,6 +61,28 @@ impl DebuggerPaneItem {
|
||||||
DebuggerPaneItem::Terminal => SharedString::new_static("Terminal"),
|
DebuggerPaneItem::Terminal => SharedString::new_static("Terminal"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub(crate) fn tab_tooltip(self) -> SharedString {
|
||||||
|
let tooltip = match self {
|
||||||
|
DebuggerPaneItem::Console => {
|
||||||
|
"Displays program output and allows manual input of debugger commands."
|
||||||
|
}
|
||||||
|
DebuggerPaneItem::Variables => {
|
||||||
|
"Shows current values of local and global variables in the current stack frame."
|
||||||
|
}
|
||||||
|
DebuggerPaneItem::BreakpointList => "Lists all active breakpoints set in the code.",
|
||||||
|
DebuggerPaneItem::Frames => {
|
||||||
|
"Displays the call stack, letting you navigate between function calls."
|
||||||
|
}
|
||||||
|
DebuggerPaneItem::Modules => "Shows all modules or libraries loaded by the program.",
|
||||||
|
DebuggerPaneItem::LoadedSources => {
|
||||||
|
"Lists all source files currently loaded and used by the debugger."
|
||||||
|
}
|
||||||
|
DebuggerPaneItem::Terminal => {
|
||||||
|
"Provides an interactive terminal session within the debugging environment."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
SharedString::new_static(tooltip)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DebuggerPaneItem> for SharedString {
|
impl From<DebuggerPaneItem> for SharedString {
|
||||||
|
|
|
@ -173,6 +173,10 @@ impl Item for SubView {
|
||||||
self.kind.to_shared_string()
|
self.kind.to_shared_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn tab_tooltip_text(&self, _: &App) -> Option<SharedString> {
|
||||||
|
Some(self.kind.tab_tooltip())
|
||||||
|
}
|
||||||
|
|
||||||
fn tab_content(
|
fn tab_content(
|
||||||
&self,
|
&self,
|
||||||
params: workspace::item::TabContentParams,
|
params: workspace::item::TabContentParams,
|
||||||
|
@ -399,6 +403,9 @@ pub(crate) fn new_debugger_pane(
|
||||||
.p_1()
|
.p_1()
|
||||||
.rounded_md()
|
.rounded_md()
|
||||||
.cursor_pointer()
|
.cursor_pointer()
|
||||||
|
.when_some(item.tab_tooltip_text(cx), |this, tooltip| {
|
||||||
|
this.tooltip(Tooltip::text(tooltip))
|
||||||
|
})
|
||||||
.map(|this| {
|
.map(|this| {
|
||||||
let theme = cx.theme();
|
let theme = cx.theme();
|
||||||
if selected {
|
if selected {
|
||||||
|
|
|
@ -176,16 +176,18 @@ impl Console {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_console(&self, cx: &Context<Self>) -> impl IntoElement {
|
fn render_console(&self, cx: &Context<Self>) -> impl IntoElement {
|
||||||
EditorElement::new(&self.console, self.editor_style(cx))
|
EditorElement::new(&self.console, Self::editor_style(&self.console, cx))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn editor_style(&self, cx: &Context<Self>) -> EditorStyle {
|
fn editor_style(editor: &Entity<Editor>, cx: &Context<Self>) -> EditorStyle {
|
||||||
|
let is_read_only = editor.read(cx).read_only(cx);
|
||||||
let settings = ThemeSettings::get_global(cx);
|
let settings = ThemeSettings::get_global(cx);
|
||||||
|
let theme = cx.theme();
|
||||||
let text_style = TextStyle {
|
let text_style = TextStyle {
|
||||||
color: if self.console.read(cx).read_only(cx) {
|
color: if is_read_only {
|
||||||
cx.theme().colors().text_disabled
|
theme.colors().text_muted
|
||||||
} else {
|
} else {
|
||||||
cx.theme().colors().text
|
theme.colors().text
|
||||||
},
|
},
|
||||||
font_family: settings.buffer_font.family.clone(),
|
font_family: settings.buffer_font.family.clone(),
|
||||||
font_features: settings.buffer_font.features.clone(),
|
font_features: settings.buffer_font.features.clone(),
|
||||||
|
@ -195,15 +197,15 @@ impl Console {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
EditorStyle {
|
EditorStyle {
|
||||||
background: cx.theme().colors().editor_background,
|
background: theme.colors().editor_background,
|
||||||
local_player: cx.theme().players().local(),
|
local_player: theme.players().local(),
|
||||||
text: text_style,
|
text: text_style,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_query_bar(&self, cx: &Context<Self>) -> impl IntoElement {
|
fn render_query_bar(&self, cx: &Context<Self>) -> impl IntoElement {
|
||||||
EditorElement::new(&self.query_bar, self.editor_style(cx))
|
EditorElement::new(&self.query_bar, Self::editor_style(&self.query_bar, cx))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_output(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn update_output(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue