Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

only render retrieve context button if semantic index is enabled

KCaverlyed894cc06fc0
diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs
index 16d7ee6b811..33d42c45dc5 100644
--- a/crates/assistant/src/assistant_panel.rs
+++ b/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")
diff --git a/crates/assistant/src/prompts.rs b/crates/assistant/src/prompts.rs
index 716fd435057..487950dbef2 100644
--- a/crates/assistant/src/prompts.rs
+++ b/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;