diff --git a/crates/feedback2/src/feedback_editor.rs b/crates/feedback2/src/feedback_editor.rs index 258b3553f8..396cd27a6a 100644 --- a/crates/feedback2/src/feedback_editor.rs +++ b/crates/feedback2/src/feedback_editor.rs @@ -33,16 +33,16 @@ actions!(GiveFeedback, SubmitFeedback); // }); // } -// #[derive(Serialize)] -// struct FeedbackRequestBody<'a> { -// feedback_text: &'a str, -// email: Option, -// metrics_id: Option>, -// installation_id: Option>, -// system_specs: SystemSpecs, -// is_staff: bool, -// token: &'a str, -// } +#[derive(Serialize)] +struct FeedbackRequestBody<'a> { + feedback_text: &'a str, + email: Option, + metrics_id: Option>, + installation_id: Option>, + system_specs: SystemSpecs, + is_staff: bool, + token: &'a str, +} // #[derive(Clone)] // pub(crate) struct FeedbackEditor { diff --git a/crates/feedback2/src/feedback_modal.rs b/crates/feedback2/src/feedback_modal.rs index 90ddb23ab2..f04f40541f 100644 --- a/crates/feedback2/src/feedback_modal.rs +++ b/crates/feedback2/src/feedback_modal.rs @@ -1,3 +1,4 @@ +use editor::Editor; use gpui::{ div, rems, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Render, ViewContext, @@ -8,7 +9,7 @@ use workspace::Workspace; use crate::feedback_editor::GiveFeedback; pub struct FeedbackModal { - // editor: View, + editor: View, tmp_focus_handle: FocusHandle, // TODO: should be editor.focus_handle(cx) } @@ -28,7 +29,22 @@ impl FeedbackModal { } pub fn new(cx: &mut ViewContext) -> Self { + let line_editor = cx.build_view(|cx| Editor::single_line(cx)); + let line_editor_change = cx.subscribe(&line_editor, Self::on_line_editor_event); + + // let editor = active_editor.read(cx); + // let cursor = editor.selections.last::(cx).head(); + // let last_line = editor.buffer().read(cx).snapshot(cx).max_point().row; + // let scroll_position = active_editor.update(cx, |editor, cx| editor.scroll_position(cx)); + + // let current_text = format!( + // "line {} of {} (column {})", + // cursor.row + 1, + // last_line + 1, + // cursor.column + 1, + // ); Self { + editor: line_editor, tmp_focus_handle: cx.focus_handle(), } }