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

Overwrites Previous Function when use continue in option #991

Open
3 tasks done
Chhunneng opened this issue Mar 19, 2024 · 4 comments
Open
3 tasks done

Overwrites Previous Function when use continue in option #991

Chhunneng opened this issue Mar 19, 2024 · 4 comments
Labels
area:inline-edit Relates to the auto refactor feature ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior

Comments

@Chhunneng
Copy link

Before submitting your bug report

Relevant environment info

- OS: macOS 14.2.1
- Continue: v0.9.90
- IDE: VSCode 1.87.1

Description

When I use continue to edit like write a docstring for this code it works. but when finished I try to select the new function and use the same feature to write a docstring for this code again, it writes on the old function again.

To reproduce

I try to use continue and it work
Screenshot 2024-03-19 at 17 02 16

Screenshot 2024-03-19 at 17 06 42

After that, I try on new function but it back to old function
Screenshot 2024-03-19 at 17 07 31

Screenshot 2024-03-19 at 17 07 59

Log output

No response

@Chhunneng Chhunneng added the bug label Mar 19, 2024
@TheLapinMalin
Copy link
Contributor

Bumping this, as I've had this issue as well with Ctrl+I:

Ctrl+I without selecting code seems to write code in other places (if you've used Ctrl+I once in the file somewhere, then move somewhere else and use Ctrl+I again, it generates code at the first Ctrl+I location again).

@justinmilner1
Copy link
Contributor

justinmilner1 commented Apr 8, 2024

I was able to replicate this - I'll add that the issue only occurs if you don't accept or reject the suggested diff, and only within the same file.

It does seem to generate a new docstring for the newly highlighted function, but it annotates the previously targeted function.

  1. Generate docstring for function 1
  2. Don’t accept or reject
  3. generate another docstring for function 2
  4. See that newly generated docstring is describing function 2, but is annotated upon function 1

I'll look into this!

@justinmilner1
Copy link
Contributor

Looks like verticalDiffs are not being updated when lines are added/removed from the file. I think the best approach will be to create a listener for changes to the document (onDidChangeTextDocument) and if the change includes a line addition or deletion, make the appropriate changes to the diffhandler instance.

@sestinj Hey Nate - Two questions:

  1. It looks like there is a 1:1 mapping of filepath to diffhandler in manager.ts, which means there can only be one vertical diff per file - is this intended functionality medium/long term?
  2. If the user has a diff open in a file, and decides to create a new diff in the same file without closing the existing one, should we delete the existing diff? (leaning toward this option)
    Or prevent the new diff from being created? (and maybe send some type of notification that there is another diff waiting to be accepted/rejected)

@sestinj
Copy link
Contributor

sestinj commented Apr 15, 2024

@justinmilner1 thanks for looking into this. 1:1 is intended for now. There's a of offsetting to keep track of if there are multiple diffs being generated in a single file, and especially if the user tries to generate over top of an existing one there's really not a great UI solution. So unless it turns out to be a majorly requested feature the plan was to keep up a guide rail.

I agree with your take about deleting the old one

@dosubot dosubot bot added area:inline-edit Relates to the auto refactor feature kind:bug Indicates an unexpected problem or unintended behavior ide:vscode Relates specifically to VS Code extension and removed bug labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:inline-edit Relates to the auto refactor feature ide:vscode Relates specifically to VS Code extension kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants