language_tools: Increase available space for language server logs (#30742)
This PR contains some small improvements for the language server log editors. Due to the large gutter as well as the introduction of the minimap, the horizontally available space was rather small. As these editors soft wrap at the editor width, it resulted in the logs becoming vertically larger and somewhat harder to read. The improvement here is to disable all elements in the gutter that will never appear or be used in the logs anyway. Furthermore, I opted to disable the minimap altogether, since from my point of view it did not contain any valuable information about the logs being shown. First image is the current main, second is this branch. I put these below each other so the difference is easier to spot.   Release Notes: - N/A
This commit is contained in:
parent
6840a4e5bc
commit
2c8049270a
2 changed files with 94 additions and 42 deletions
|
@ -716,18 +716,39 @@ impl ScrollbarMarkerState {
|
|||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum MinimapVisibility {
|
||||
Disabled,
|
||||
Enabled(bool),
|
||||
Enabled {
|
||||
/// The configuration currently present in the users settings.
|
||||
setting_configuration: bool,
|
||||
/// Whether to override the currently set visibility from the users setting.
|
||||
toggle_override: bool,
|
||||
},
|
||||
}
|
||||
|
||||
impl MinimapVisibility {
|
||||
fn for_mode(mode: &EditorMode, cx: &App) -> Self {
|
||||
if mode.is_full() {
|
||||
Self::Enabled(EditorSettings::get_global(cx).minimap.minimap_enabled())
|
||||
Self::Enabled {
|
||||
setting_configuration: EditorSettings::get_global(cx).minimap.minimap_enabled(),
|
||||
toggle_override: false,
|
||||
}
|
||||
} else {
|
||||
Self::Disabled
|
||||
}
|
||||
}
|
||||
|
||||
fn hidden(&self) -> Self {
|
||||
match *self {
|
||||
Self::Enabled {
|
||||
setting_configuration,
|
||||
..
|
||||
} => Self::Enabled {
|
||||
setting_configuration,
|
||||
toggle_override: setting_configuration,
|
||||
},
|
||||
Self::Disabled => Self::Disabled,
|
||||
}
|
||||
}
|
||||
|
||||
fn disabled(&self) -> bool {
|
||||
match *self {
|
||||
Self::Disabled => true,
|
||||
|
@ -735,16 +756,35 @@ impl MinimapVisibility {
|
|||
}
|
||||
}
|
||||
|
||||
fn settings_visibility(&self) -> bool {
|
||||
match *self {
|
||||
Self::Enabled {
|
||||
setting_configuration,
|
||||
..
|
||||
} => setting_configuration,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn visible(&self) -> bool {
|
||||
match *self {
|
||||
Self::Enabled(visible) => visible,
|
||||
Self::Enabled {
|
||||
setting_configuration,
|
||||
toggle_override,
|
||||
} => setting_configuration ^ toggle_override,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_visibility(&self) -> Self {
|
||||
match *self {
|
||||
Self::Enabled(visible) => Self::Enabled(!visible),
|
||||
Self::Enabled {
|
||||
toggle_override,
|
||||
setting_configuration,
|
||||
} => Self::Enabled {
|
||||
setting_configuration,
|
||||
toggle_override: !toggle_override,
|
||||
},
|
||||
Self::Disabled => Self::Disabled,
|
||||
}
|
||||
}
|
||||
|
@ -16979,6 +17019,10 @@ impl Editor {
|
|||
self.set_minimap_visibility(MinimapVisibility::Disabled, window, cx);
|
||||
}
|
||||
|
||||
pub fn hide_minimap_by_default(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
self.set_minimap_visibility(self.minimap_visibility.hidden(), window, cx);
|
||||
}
|
||||
|
||||
/// Normally the text in full mode and auto height editors is padded on the
|
||||
/// left side by roughly half a character width for improved hit testing.
|
||||
///
|
||||
|
@ -18518,9 +18562,9 @@ impl Editor {
|
|||
}
|
||||
|
||||
let minimap_settings = EditorSettings::get_global(cx).minimap;
|
||||
if self.minimap_visibility.visible() != minimap_settings.minimap_enabled() {
|
||||
if self.minimap_visibility.settings_visibility() != minimap_settings.minimap_enabled() {
|
||||
self.set_minimap_visibility(
|
||||
self.minimap_visibility.toggle_visibility(),
|
||||
MinimapVisibility::for_mode(self.mode(), cx),
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue