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

Breakpoint moves with copy line up/down action #75426

Open
eyalroth opened this issue Jun 13, 2019 · 6 comments
Open

Breakpoint moves with copy line up/down action #75426

eyalroth opened this issue Jun 13, 2019 · 6 comments
Assignees
Labels
editor-contrib Editor collection of extras under-discussion Issue is under discussion for relevance, priority, approach

Comments

@eyalroth
Copy link

Version:

  • VSCode Version: 1.35.0
  • OS Version: Windows 10.0.17134.799

Steps to Reproduce:

  1. Create a new code file (of any supported language).
  2. Write a few lines of code.
  3. Place a break-point on a line.
  4. Copy the line using Copy Line Up or Copy Line Down actions.

Bug:
The break-point moves with the copied line. It should stay.

Does this issue occur when all extensions are disabled? Yes

@vscodebot
Copy link

vscodebot bot commented Jun 13, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the editor-clipboard Editor clipboard issues label Jun 13, 2019
@Tyriar Tyriar removed the editor-clipboard Editor clipboard issues label Jun 13, 2019
@alexdima
Copy link
Member

alexdima commented Oct 9, 2019

This is as designed... The copy line down action is implemented by inserting the line text above it, so that's why the breakpoint moves. We will not reimplement the action just to accommodate this case, and it is IMHO not clearly wrong...

@alexdima alexdima closed this as completed Oct 9, 2019
@alexdima alexdima added the *as-designed Described behavior is as designed label Oct 9, 2019
@eyalroth
Copy link
Author

eyalroth commented Oct 10, 2019

@alexandrudima This really doesn't seem to be as designed but rather a clear oversight, and for multiple reasons:

  1. It's a copy action -- not a move action -- and the normal copy+paste action doesn't move any breakpoints around. Even cutting a line doesn't move the breakpoint.
  2. The are more bugs produced by this behavior; for instance, after completing the reproduction steps described in this issue, if one deletes said line the breakpoint will move to the next (non duplicated) line instead of the original one, and if one then tries to undo these steps, the breakpoint will remain on the next line which has nothing to do with the original one.
  3. Both IntelliJ and Eclipse -- two of the most popular IDEs out there -- do not exhibit this behavior.
  4. Copying a line via the Copy Line Up/Down action is intended to create a new line which is similar to the original one. It's a means of creating new content which looks like old content. It is not meant to alter the original content, which goes for its state as well.
  5. This behavior actually goes further than just breakpoints. For instance, the bookmark of a line marked with the bookmarks extension will behave similar to how a breakpoint does, which makes no sense. Duplicating a line definitely shouldn't move the bookmark around, as it belongs to the original line which is not about to be modified (unlike the newly duplicated line).

@alexdima alexdima reopened this Oct 11, 2019
@alexdima alexdima added editor-contrib Editor collection of extras and removed *as-designed Described behavior is as designed labels Oct 11, 2019
@alefragnani
Copy link

I wouldn't say that keeping the breakpoint, bookmark, or any other decoration/data in the original line is correct either, because the command is Copy Line Up/Down, so users could expect that it should copy the breakpoint/bookmark/etc to the next/previous line, duplicating it.

I'm not sure if copying/cutting the entire line shouldn't bring its breakpoint/bookmarks (sometimes I hoped it should). But to this, the API should be updated to describe the original
Line/Range.

IMHO, I prefer the way it works today, even with this naming conflict. The Bookmarks extension, at least, should remain this way.

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 11, 2020
@hediet hediet added under-discussion Issue is under discussion for relevance, priority, approach and removed bug Issue identified by VS Code Team member as probable bug labels Oct 14, 2021
@hediet
Copy link
Member

hediet commented Oct 14, 2021

I think the copy line up/down action really should also copy all break points, bookmarks and other stuff associated to the line.

Unfortunately, as far as I know, there is no generic way to (deep-) copy all the associated data.
For example, the bookmark extension might have its own data structure to manage the line-associated bookmarks.


Since copying the associated data is off the table, we can still control if the original or the copy should get all the associated data.

I think there are valid arguments for both the old (original) and the new (copied) line, so this is not clearly a bug, but rather the behavior is open for discussion.

@alefragnani
Copy link

alefragnani commented Oct 21, 2021

Yes, the Bookmarks extension has its own storage, and a custom sticky algorithm to update the Bookmark position (line) when the user changes the file.

Technically speaking, I guess (I'm not in front of my computer) (confirmed) it works this way because the Copy Line Down command, in fact, doesn't add a copy of the current line, in the next line (down). Instead, it adds the copy in the place of the current line, moving the so called current line, one line below. Doing so, the Bookmark follows the original line, going one line below, just like it does when you hit Return at the beginning of the current line.

@hediet hediet added this to the Backlog Candidates milestone Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-contrib Editor collection of extras under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

5 participants