Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement the abort signal in /edit diff gen #1027

Open
wants to merge 7 commits into
base: preview
Choose a base branch
from

Conversation

Iamshankhadeep
Copy link
Contributor

@Iamshankhadeep Iamshankhadeep commented Mar 26, 2024

fixes #1012

@Iamshankhadeep Iamshankhadeep marked this pull request as draft March 26, 2024 14:57
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit d9a6691
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/66034ffad42e7f00089e28f3

@Iamshankhadeep Iamshankhadeep marked this pull request as ready for review March 26, 2024 22:45
@Iamshankhadeep Iamshankhadeep changed the base branch from main to preview March 26, 2024 22:56
@@ -114,6 +114,10 @@ export async function* ideStreamRequest<T extends keyof WebviewProtocol>(
let returnVal = undefined;

const handler = (event: { data: Message }) => {
// console.log("Received message", event.data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@sestinj
Copy link
Contributor

sestinj commented Apr 1, 2024

@Iamshankhadeep I think there might be a simpler solution as I'm looking at this.

There's already a built-in cancellation method for the webview protocol that is used here (https://github.com/continuedev/continue/blob/preview/extensions/vscode/src/webviewProtocol.ts#L347) which we could apply here (https://github.com/continuedev/continue/blob/preview/extensions/vscode/src/webviewProtocol.ts#L411) in order to allow cancellation from the webview.

And then to cancel with a keyboard shortcut, rather than adding a new one, I want to use the shortcut we already have (cmd+shift+backspace) which is implemented here. If you just make the above change first, I actually think that this line of code might already solve the problem with the command (I know we had this working before, and I think that is how)

So in summary, maybe we should just add this to here

@justinmilner1
Copy link
Contributor

@Iamshankhadeep @sestinj
Adding the if block from llmStreamChat to runNodeJsSlashCommand on its own doesn't work because the abort is never triggered. I think this is because ideStreamRequest never yields anything back to _streamSlashCommand (where the state.active property is checked and abort is called) until the end of the stream.

However, if we keep the check for setInactive message ideStreamRequest's handler, then the abort is sent and the streaming cancels on command! This works.

Note that this still doesn't work for ctrl+backspace (only works for ctrl+shift+backspace).

@sestinj
Copy link
Contributor

sestinj commented Apr 4, 2024

@justinmilner1 yes this looks perfect! @Iamshankhadeep would you want to adjust to use this solution, or would it be most convenient if I went ahead and just changed this locally and pushed?

@Iamshankhadeep Iamshankhadeep reopened this Apr 4, 2024
@Iamshankhadeep
Copy link
Contributor Author

@sestinj I have updated the PR, with the new code that @justinmilner1 suggested.

@justinmilner1
Copy link
Contributor

I do think the 'shift+ctrl+backspace' shortcut should be added to package.json keybindings pathway, to match the documentation.
I don't think the gui.tsx pathway can provide the cancellation without major refactoring.

@justinmilner1
Copy link
Contributor

Hey @Iamshankhadeep - Do you want to wrap this one up?

@justinmilner1
Copy link
Contributor

Okay I'm gonna get this closed out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CON-223] Cmd/Ctrl + Shift + Backspace doesn't stop streaming of diff
3 participants