temp

Joseph T. Lyons created

Change summary

crates/feedback2/src/feedback_editor.rs | 20 ++++++++++----------
crates/feedback2/src/feedback_modal.rs  | 18 +++++++++++++++++-
2 files changed, 27 insertions(+), 11 deletions(-)

Detailed changes

crates/feedback2/src/feedback_editor.rs 🔗

@@ -33,16 +33,16 @@ actions!(GiveFeedback, SubmitFeedback);
 //     });
 // }
 
-// #[derive(Serialize)]
-// struct FeedbackRequestBody<'a> {
-//     feedback_text: &'a str,
-//     email: Option<String>,
-//     metrics_id: Option<Arc<str>>,
-//     installation_id: Option<Arc<str>>,
-//     system_specs: SystemSpecs,
-//     is_staff: bool,
-//     token: &'a str,
-// }
+#[derive(Serialize)]
+struct FeedbackRequestBody<'a> {
+    feedback_text: &'a str,
+    email: Option<String>,
+    metrics_id: Option<Arc<str>>,
+    installation_id: Option<Arc<str>>,
+    system_specs: SystemSpecs,
+    is_staff: bool,
+    token: &'a str,
+}
 
 // #[derive(Clone)]
 // pub(crate) struct FeedbackEditor {

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<FeedbackEditor>,
+    editor: View<Editor>,
     tmp_focus_handle: FocusHandle, // TODO: should be editor.focus_handle(cx)
 }
 
@@ -28,7 +29,22 @@ impl FeedbackModal {
     }
 
     pub fn new(cx: &mut ViewContext<Self>) -> 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::<Point>(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(),
         }
     }