Open Chhunneng opened 5 months ago
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).
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!
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)
@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
Before submitting your bug report
Relevant environment info
Description
When I use
continue
to edit likewrite a docstring for this code
it works. but when finished I try to select the new function and use the same feature towrite a docstring for this code
again, it writes on the oldfunction
again.To reproduce
I try to use continue and it work
After that, I try on new function but it back to old function
Log output
No response