mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-29 05:11:44 +03:00
Fix rustfmt by pulling out long string into constant
This commit is contained in:
parent
1cbdf2ba22
commit
62f5becf1f
@ -282,6 +282,8 @@ impl EventEmitter<ViewEvent> for ProjectSearchView {}
|
|||||||
|
|
||||||
impl Render for ProjectSearchView {
|
impl Render for ProjectSearchView {
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
|
const PLEASE_AUTHENTICATE: &str = "API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables. If you authenticated using the Assistant Panel, please restart Zed to Authenticate.";
|
||||||
|
|
||||||
if self.has_matches() {
|
if self.has_matches() {
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
@ -303,40 +305,39 @@ impl Render for ProjectSearchView {
|
|||||||
let mut show_minor_text = true;
|
let mut show_minor_text = true;
|
||||||
let semantic_status = self.semantic_state.as_ref().and_then(|semantic| {
|
let semantic_status = self.semantic_state.as_ref().and_then(|semantic| {
|
||||||
let status = semantic.index_status;
|
let status = semantic.index_status;
|
||||||
match status {
|
match status {
|
||||||
SemanticIndexStatus::NotAuthenticated => {
|
SemanticIndexStatus::NotAuthenticated => {
|
||||||
major_text = Label::new("Not Authenticated");
|
major_text = Label::new("Not Authenticated");
|
||||||
show_minor_text = false;
|
show_minor_text = false;
|
||||||
Some(
|
Some(PLEASE_AUTHENTICATE.to_string())
|
||||||
"API Key Missing: Please set 'OPENAI_API_KEY' in Environment Variables. If you authenticated using the Assistant Panel, please restart Zed to Authenticate.".to_string())
|
}
|
||||||
}
|
SemanticIndexStatus::Indexed => Some("Indexing complete".to_string()),
|
||||||
SemanticIndexStatus::Indexed => Some("Indexing complete".to_string()),
|
SemanticIndexStatus::Indexing {
|
||||||
SemanticIndexStatus::Indexing {
|
remaining_files,
|
||||||
remaining_files,
|
rate_limit_expiry,
|
||||||
rate_limit_expiry,
|
} => {
|
||||||
} => {
|
if remaining_files == 0 {
|
||||||
if remaining_files == 0 {
|
Some("Indexing...".to_string())
|
||||||
Some("Indexing...".to_string())
|
} else {
|
||||||
} else {
|
if let Some(rate_limit_expiry) = rate_limit_expiry {
|
||||||
if let Some(rate_limit_expiry) = rate_limit_expiry {
|
let remaining_seconds =
|
||||||
let remaining_seconds =
|
rate_limit_expiry.duration_since(Instant::now());
|
||||||
rate_limit_expiry.duration_since(Instant::now());
|
if remaining_seconds > Duration::from_secs(0) {
|
||||||
if remaining_seconds > Duration::from_secs(0) {
|
Some(format!(
|
||||||
Some(format!(
|
"Remaining files to index (rate limit resets in {}s): {}",
|
||||||
"Remaining files to index (rate limit resets in {}s): {}",
|
remaining_seconds.as_secs(),
|
||||||
remaining_seconds.as_secs(),
|
remaining_files
|
||||||
remaining_files
|
))
|
||||||
))
|
} else {
|
||||||
} else {
|
Some(format!("Remaining files to index: {}", remaining_files))
|
||||||
Some(format!("Remaining files to index: {}", remaining_files))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Some(format!("Remaining files to index: {}", remaining_files))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SemanticIndexStatus::NotIndexed => None,
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Some(format!("Remaining files to index: {}", remaining_files))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SemanticIndexStatus::NotIndexed => None,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let major_text = div().justify_center().max_w_96().child(major_text);
|
let major_text = div().justify_center().max_w_96().child(major_text);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user