only render retrieve context button if semantic index is enabled

KCaverly created

Change summary

crates/assistant/src/assistant_panel.rs | 28 +++++++++++++++-----------
crates/assistant/src/prompts.rs         |  1 
2 files changed, 16 insertions(+), 13 deletions(-)

Detailed changes

crates/assistant/src/assistant_panel.rs 🔗

@@ -2750,18 +2750,22 @@ impl View for InlineAssistant {
                             .element()
                             .aligned(),
                     )
-                    .with_child(
-                        Button::action(ToggleRetrieveContext)
-                            .with_tooltip("Retrieve Context", theme.tooltip.clone())
-                            .with_id(self.id)
-                            .with_contents(theme::components::svg::Svg::new(
-                                "icons/magnifying_glass.svg",
-                            ))
-                            .toggleable(self.retrieve_context)
-                            .with_style(theme.assistant.inline.retrieve_context.clone())
-                            .element()
-                            .aligned(),
-                    )
+                    .with_children(if SemanticIndex::enabled(cx) {
+                        Some(
+                            Button::action(ToggleRetrieveContext)
+                                .with_tooltip("Retrieve Context", theme.tooltip.clone())
+                                .with_id(self.id)
+                                .with_contents(theme::components::svg::Svg::new(
+                                    "icons/magnifying_glass.svg",
+                                ))
+                                .toggleable(self.retrieve_context)
+                                .with_style(theme.assistant.inline.retrieve_context.clone())
+                                .element()
+                                .aligned(),
+                        )
+                    } else {
+                        None
+                    })
                     .with_children(if let Some(error) = self.codegen.read(cx).error() {
                         Some(
                             Svg::new("icons/error.svg")

crates/assistant/src/prompts.rs 🔗

@@ -2,7 +2,6 @@ use crate::codegen::CodegenKind;
 use language::{BufferSnapshot, OffsetRangeExt, ToOffset};
 use std::cmp::{self, Reverse};
 use std::fmt::Write;
-use std::iter;
 use std::ops::Range;
 use tiktoken_rs::ChatCompletionRequestMessage;