-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Debugger: fix adding a breakpoint on an empty line of code and reclicking after addition #17923
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
Debugger: fix adding a breakpoint on an empty line of code and reclicking after addition #17923
Conversation
…e the case of trying to add a breakpoint on an empty line of code.
|
Thanks for making a pull request to jupyterlab! |
|
Maybe if we are redirecting to a different line which already has a breakpoint that breakpoint should become selected to give user a feedback on what just happened? |
| targetLine.number | ||
| ) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @JohanMabille. The comment has been taken into account in the following commit.
…od and update _onGutterClick method accordingly.
@krassowski Thanks for your suggestion. I missed your comment. I will try to implement this now. |
JohanMabille
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current changes look good to me.
…clicking on an empty line.
This is new behavior, taking your comment into account @krassowski |
Looks great!! |
…int assignment when removing the selected breakpoint.
|
I just make a slight change, in order to not have the selected breakpoint becoming red when clicking for its removal |
|
UI tests are failing but it doesn't seem related to this PR. |
Most likely unrelated but we would want a green status before merging - if you could review #17928 that would help to fix it! |
| } | ||
| } | ||
| } else { | ||
| (isLineEmpty = false), (targetLine = clickedLine); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rather unusual style. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it is not intentional. Will change it to a more usual style.
This would be unrelated. |
0a1d300 to
5caa757
Compare
krassowski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @HaudinFlorence!
Thank you for the review and for the help @krassowski |
When clicking on an empty line of code, a breakpoint is added to the first non empty previous line. In case there is already a breakpoint at this line, a second breakpoint was temporarily added in a second gutter line, in the time lapse of the click. To get rid of this behavior and in order to not remove the already present breakpoint, a modification of the
_onGutterClickmethod was proposed.Previously
Screencast From 2025-09-25 08-57-52.webm
With the solution of this PR (kernel blinking indicates the clicks on the gutter without any addition of a second breakpoint)
Screencast From 2025-09-25 08-59-32.webm
References
Should fix issue #17903
Code changes
Update the
_onGutterClickmethod fromEditorHandlerclass.Introduce a private
_getEffectiveClickedLinemethod that:isLineEmptyset to trueisLineEmptyset tofalseIn the
__onGutterClick, when clicking at the effective clicked position:- remove it if the line is not empty
- make the already present breakpoint the selected to inform the user of what happens if the initially clicked position is not empty
User-facing changes
Backwards-incompatible changes