diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs index 88896f51086dc5f7d3eddb2fffef2fa3a7039c79..ed1e8afd1b3b3220d31119f7292b6b0934cd2ba7 100644 --- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs +++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs @@ -7,8 +7,8 @@ use anyhow::{Context as _, Result}; use context_server::{ContextServerCommand, ContextServerId}; use editor::{Editor, EditorElement, EditorStyle}; use gpui::{ - AsyncWindowContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Task, - TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity, prelude::*, + AsyncWindowContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ScrollHandle, + Task, TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity, prelude::*, }; use language::{Language, LanguageRegistry}; use markdown::{Markdown, MarkdownElement, MarkdownStyle}; @@ -23,7 +23,8 @@ use project::{ use settings::{Settings as _, update_settings_file}; use theme::ThemeSettings; use ui::{ - CommonAnimationExt, KeyBinding, Modal, ModalFooter, ModalHeader, Section, Tooltip, prelude::*, + CommonAnimationExt, KeyBinding, Modal, ModalFooter, ModalHeader, Section, Tooltip, + WithScrollbar, prelude::*, }; use util::ResultExt as _; use workspace::{ModalView, Workspace}; @@ -252,6 +253,7 @@ pub struct ConfigureContextServerModal { source: ConfigurationSource, state: State, original_server_id: Option, + scroll_handle: ScrollHandle, } impl ConfigureContextServerModal { @@ -361,6 +363,7 @@ impl ConfigureContextServerModal { window, cx, ), + scroll_handle: ScrollHandle::new(), }) }) }) @@ -680,6 +683,7 @@ impl ConfigureContextServerModal { impl Render for ConfigureContextServerModal { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { + let scroll_handle = self.scroll_handle.clone(); div() .elevation_3(cx) .w(rems(34.)) @@ -699,14 +703,29 @@ impl Render for ConfigureContextServerModal { Modal::new("configure-context-server", None) .header(self.render_modal_header()) .section( - Section::new() - .child(self.render_modal_description(window, cx)) - .child(self.render_modal_content(cx)) - .child(match &self.state { - State::Idle => div(), - State::Waiting => Self::render_waiting_for_context_server(), - State::Error(error) => Self::render_modal_error(error.clone()), - }), + Section::new().child( + div() + .size_full() + .child( + div() + .id("modal-content") + .max_h(vh(0.7, window)) + .overflow_y_scroll() + .track_scroll(&scroll_handle) + .child(self.render_modal_description(window, cx)) + .child(self.render_modal_content(cx)) + .child(match &self.state { + State::Idle => div(), + State::Waiting => { + Self::render_waiting_for_context_server() + } + State::Error(error) => { + Self::render_modal_error(error.clone()) + } + }), + ) + .vertical_scrollbar_for(scroll_handle, window, cx), + ), ) .footer(self.render_modal_footer(cx)), )