-
Notifications
You must be signed in to change notification settings - Fork 593
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
Generated code suggestion can't be applied to the file correctly #6171
Comments
This has to do with the re-positioning of comments when the file changes. |
Here's one of the things that can happen:
|
In VS Code core, we're going to need to propagate range changes back to the extension. |
Making this change could break extensions if they're using the VS Code CommentThread API as their data model. I'll need to discuss at the API sync. @chrmarti FYI. |
Thinking about it some more, I think each extension should handle this. Each extension might have a different idea of what file reversion is original. There is also a bug in VS Code that I'll fix, but otherwise, each extension should maintain a mapping of their comment's location to a location in a text document. |
I think it would help extensions if VS Code just moved comments along as lines are added / removed. Are you saying you would need the previous revision to restore the correct position after the window reloads because the updated positions are not stored? |
I'm not sure it's possible for VS Code to know where the right position is.
GHPR already does step 4, and presumably other comment providing extensions do the same. What VS Code core should definitely do is move the comment based on active editing of the file. Ex., there's a comment on line 3 and you edit the file in VS Code and insert 2 lines above that: the comment should move to line 5. |
Testing #6160
Initial code
new code
The generated code suggestion
However when applied to the editor, the file was in a broken state
The text was updated successfully, but these errors were encountered: