edit prediction: Context debug view (#38435)
Adds a `dev: open edit prediction context` action that opens a new workspace pane that displays the excerpts and snippets that would be included in the edit prediction request. Release Notes: - N/A --------- Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
use component::{example_group, single_example};
|
||||
use editor::{Editor, EditorElement, EditorStyle};
|
||||
use gpui::{App, Entity, FocusHandle, Focusable, FontStyle, Hsla, TextStyle};
|
||||
use gpui::{App, Entity, FocusHandle, Focusable, FontStyle, Hsla, Length, TextStyle};
|
||||
use settings::Settings;
|
||||
use std::sync::Arc;
|
||||
use theme::ThemeSettings;
|
||||
@@ -42,6 +42,8 @@ pub struct SingleLineInput {
|
||||
start_icon: Option<IconName>,
|
||||
/// Whether the text field is disabled.
|
||||
disabled: bool,
|
||||
/// The minimum width of for the input
|
||||
min_width: Length,
|
||||
}
|
||||
|
||||
impl Focusable for SingleLineInput {
|
||||
@@ -67,6 +69,7 @@ impl SingleLineInput {
|
||||
editor,
|
||||
start_icon: None,
|
||||
disabled: false,
|
||||
min_width: px(192.).into(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +88,11 @@ impl SingleLineInput {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn label_min_width(mut self, width: impl Into<Length>) -> Self {
|
||||
self.min_width = width.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_disabled(&mut self, disabled: bool, cx: &mut Context<Self>) {
|
||||
self.disabled = disabled;
|
||||
self.editor
|
||||
@@ -167,7 +175,7 @@ impl Render for SingleLineInput {
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.min_w_48()
|
||||
.min_w(self.min_width)
|
||||
.min_h_8()
|
||||
.w_full()
|
||||
.px_2()
|
||||
|
||||
Reference in New Issue
Block a user