Skip to content

Commit

Permalink
fix: collect_snippet should handle NotReady error
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Nov 4, 2023
1 parent 3df3ad4 commit c21ea48
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/tabby/src/serve/completions/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ fn collect_snippets(index_server: &IndexServer, language: &str, text: &str) -> V
let mut ret = Vec::new();
let mut tokens = tokenize_text(text);

let language_query = index_server.language_query(language).unwrap();
let body_query = index_server.body_query(&tokens).unwrap();
let Ok(language_query) = index_server.language_query(language) else {
return vec![];
};
let Ok(body_query) = index_server.body_query(&tokens) else {
return vec![];
};
let query = BooleanQuery::new(vec![
(Occur::Must, language_query),
(Occur::Must, body_query),
Expand Down

0 comments on commit c21ea48

Please sign in to comment.