rubberduck-ai / rubberduck-vscode

Use AI-powered code edits, explanations, code generation, error diagnosis, and chat in Visual Studio Code with the official OpenAI API.
https://marketplace.visualstudio.com/items?itemName=Rubberduck.rubberduck-vscode
MIT License
604 stars 75 forks source link

"Edit Code" follow-up suggestions aren't applied to code #14

Closed nicoespeon closed 1 year ago

nicoespeon commented 1 year ago
  1. Run "Edit Code"
  2. Give instructions to get a suggestion
  3. Don't apply the suggestion, continue the discussion with follow-up instructions to get a better suggestion
  4. Apply the latest suggestion => It will apply the old one instead

Clicking "Apply" should really apply the latest diff. Something isn't properly updated here.

nicoespeon commented 1 year ago

Fixed. We used to only set the callback the first time the editor was created. So I:

  1. Moved it out the conditional, so we set the callback every time the code is updated
  2. Changed the diff editor to dispose of the previous callbacks (so it doesn't execute old diffs)