Skip to content

Commit

Permalink
Merge pull request #469 from codestoryai/features/tree-sitter-check-o…
Browse files Browse the repository at this point in the history
…n-multiline

[sidecar] only check with tree-sitter when its multiline
  • Loading branch information
theskcd authored Feb 21, 2024
2 parents 8abf0ea + c440bde commit 489a10b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sidecar/src/inline_completion/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl FillInMiddleCompletionAgent {
// we are going ot early bail here if we have reached the end of the stream
if let Ok(value) = should_end_stream.lock() {
if *value {
return futures::future::ready(true);
return futures::future::ready(false);
}
}
}
Expand Down Expand Up @@ -393,6 +393,12 @@ fn check_terminating_condition(
// but here we need to take care of it
// we can either do tree-sitter based termination or based on indentation as well
// this will help us understand if we can give the user sustainable replies
// another condition we can add here is to only check this when we have a multiline completion
// this way we can avoid unnecessary computation
let inserted_text_lines_length = inserted_text.lines().into_iter().collect::<Vec<_>>().len();
if inserted_text_lines_length <= 1 {
return false;
}
if let Some(language_config) = language_config {
// we need to call the tree-sitter based termination here
let terminating_condition = check_terminating_condition_tree_sitter(
Expand Down

0 comments on commit 489a10b

Please sign in to comment.