Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Extra breakpoints created every character typed #414

Closed
jasongrout opened this issue Apr 1, 2020 · 4 comments
Closed

Extra breakpoints created every character typed #414

jasongrout opened this issue Apr 1, 2020 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@jasongrout
Copy link

When I edit a line with a breakpoint, it seems to create new breakpoints for the edits as I type them in, rather than just when I run the cell. This is in JLab 2.1.0rc0 and:

xeus-python               0.6.13           py38ha0d09dd_1    conda-forge
% jupyter labextension list
JupyterLab v2.1.0rc0
Known labextensions:
   app dir: /var/folders/ln/5623mk393v77n5l3rk2x88h00000gp/T/tmpenv.jWlUymub/env/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/debugger v0.2.0  enabled  OK
        @jupyterlab/toc v3.0.0  enabled  OK
        @lckr/jupyterlab_variableinspector v0.5.0  enabled  OK

Here, when I type "myvar", I am just pausing, and after every character I type a new breakpoint appears.
breakpoints

@jtpio
Copy link
Member

jtpio commented Apr 2, 2020

Thanks for the issue and demo.

Yes, the content of the cell needs to be dumped as a file on the backend to be able to set breakpoints (more info in #49, #162, #64)

Since the cells are identified using the murmur hash of their content, this is why they show up as different files with breakpoints.

One thing that could be done is to only show the breakpoints for the visible cells in the notebook, even though more exist as files on the backend. Some of this is discussed in https://github.com/jupyterlab/debugger/issues/171.

@JohanMabille
Copy link
Member

I think keeping the breakpoints for the whole notebook is pretty convenient. Another solution could be to "remember" when a cell gets the focus, and if its content is changed, first send a setBreakpoint request with an empty breakpoints list to the backend. This way the backend keeps the list of actual breakpoints, not the whole history.

@afshin afshin added the bug Something isn't working label Apr 7, 2020
@afshin afshin added this to the 0.3.0 milestone Apr 7, 2020
@KrzysztofSikoraCodete
Copy link
Contributor

@JohanMabille Thanks for explanation

What we need is to get the path when the cell gets the focus, and remember it.
but only when the cell already has breakpoints. We need kind of state pattern.

  1. The cell get the focus, if breakpoints have been set, then enter for example "hold-on" state.
  2. When no breakpoints then stay in "default state".
  • from "default state", everything works as now

From "hold-on" state:

  1. When the cell loses the focus before any type event, then return to default state and do nothing.

  2. When some typing is done but no new line has been added, then send a breakpoint request with old path and an empty breakpoint list (empty array) then go to default mode and send breakpoint request with the new code and the breakpoint list.

  3. When some typing is done and a new line is added somewhere then send a breakpoint request with old path and an empty breakpoint list, then compute the new lines numbers of impacted breakpoints (this can be done in a new state) and send the new breakpoints list as if they were just added.

@jtpio
Copy link
Member

jtpio commented Jul 13, 2020

This should now be fixed (by #436 and #474)

Can be tested on Binder: https://mybinder.org/v2/gh/jupyterlab/debugger/master?urlpath=/lab/tree/examples/index.ipynb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants