From d45ce41f6476a96cd0e4d375f7cd00393865d9cf Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 27 Jun 2023 11:03:44 -0700 Subject: stop completion early, accept all improvements --- continuedev/src/continuedev/core/autopilot.py | 2 +- continuedev/src/continuedev/core/sdk.py | 3 +++ continuedev/src/continuedev/steps/core/core.py | 4 +++- extension/src/lang-server/codeLens.ts | 4 ++++ extension/src/suggestions.ts | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py index a6e688ae..17eb70b3 100644 --- a/continuedev/src/continuedev/core/autopilot.py +++ b/continuedev/src/continuedev/core/autopilot.py @@ -121,7 +121,7 @@ class Autopilot(ContinueBaseModel): # If a parent step is deleted/cancelled, don't run this step last_depth = self._step_depth i = self.history.current_index - while i >= 0 and self.history.timeline[i].depth == last_depth + 1: + while i >= 0 and self.history.timeline[i].depth == last_depth - 1: if self.history.timeline[i].deleted: return None last_depth = self.history.timeline[i].depth diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index d6acc404..8b82aee0 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -207,3 +207,6 @@ class ContinueSDK(AbstractContinueSDK): async def clear_history(self): await self.__autopilot.clear_history() + + def current_step_was_deleted(self): + return self.history.timeline[self.history.current_index].deleted diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py index ae58cc99..4ec8fe9e 100644 --- a/continuedev/src/continuedev/steps/core/core.py +++ b/continuedev/src/continuedev/steps/core/core.py @@ -323,9 +323,11 @@ class DefaultModelEditCodeStep(Step): current_block_lines.append(line) async for chunk in model_to_use.stream_chat(prompt, with_history=await sdk.get_chat_context(), temperature=0): - # Stop early if it is repeating the file_suffix + # Stop early if it is repeating the file_suffix or the step was deleted if repeating_file_suffix: break + if sdk.current_step_was_deleted(): + return # Accumulate lines chunk_lines = chunk.split("\n") diff --git a/extension/src/lang-server/codeLens.ts b/extension/src/lang-server/codeLens.ts index 3979b64d..629da0b8 100644 --- a/extension/src/lang-server/codeLens.ts +++ b/extension/src/lang-server/codeLens.ts @@ -28,6 +28,10 @@ class SuggestionsCodeLensProvider implements vscode.CodeLensProvider { title: "Reject ❌", command: "continue.rejectSuggestion", arguments: [suggestion], + }), + new vscode.CodeLens(range, { + title: "(⌘⇧↩/⌘⇧⌫ to accept/reject all)", + command: "", }) ); } diff --git a/extension/src/suggestions.ts b/extension/src/suggestions.ts index 4631c33e..209bf8b2 100644 --- a/extension/src/suggestions.ts +++ b/extension/src/suggestions.ts @@ -246,7 +246,7 @@ function handleAllSuggestions(accept: boolean) { if (!suggestions) return; while (suggestions.length > 0) { - selectSuggestion(accept ? "new" : "old"); + selectSuggestion(accept ? "new" : "old", suggestions[0]); } } -- cgit v1.2.3-70-g09d2