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

Incorrect line number in debugging cells #8263

Closed
BradXiao opened this issue Nov 15, 2021 · 5 comments
Closed

Incorrect line number in debugging cells #8263

BradXiao opened this issue Nov 15, 2021 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window interactive-window-debugging verified Verification succeeded
Milestone

Comments

@BradXiao
Copy link

Environment data

  • VS Code version: 1.62.2
  • Jupyter Extension version (available under the Extensions sidebar): 2021.10.1101450599
  • Python Extension version (available under the Extensions sidebar): 2021.11.1422169775
  • ipykernel: 6.5.0
  • OS (Windows | Mac | Linux distro) and version: Windows
  • Python and/or Anaconda version: Python 3.7.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jupyter server running: Local

Expected behaviour

Debug a function locating the corresponding line.

Actual behaviour

Debug at the incorrect line.

Steps to reproduce:

  1. Create and run a cell (cell A) containing a function definition with 'def' at the first line.
  2. Create and debug a cell (cell B) calling the defined function.
  3. Modify (add two more lines) cell A and run the cell
  4. Debug cell B

2021_11_15_10_12_21_693

Logs

Info 2021-11-15 10:01:40: Executing (status Idle) silently Code = import debugpy;debugpy.listen(('localhost', 0))
Info 2021-11-15 10:01:40: Executing silently Code (completed) = import debugpy;debugpy.listen(('localhost', 0))
Info 2021-11-15 10:01:40: connected to notebook during debugging
Info 2021-11-15 10:01:40: Executing (status Idle) silently Code = import debugpy;debugpy.wait_for_client()
Info 2021-11-15 10:01:40: Executing silently Code (completed) = import debugpy;debugpy.wait_for_client()
Info 2021-11-15 10:01:40: import startup: undefined
Info 2021-11-15 10:01:40: Executing (and forget) (status Idle) silently Code = from debugpy import trace_this_thread;trace_this_thread(False)
Info 2021-11-15 10:01:40: Adding hash for 3 = bea1735ac853 with 2 lines
Info 2021-11-15 10:01:40: Executing (and forget) (status Idle) silently Code = from debugpy import trace_this_thread;trace_this_thread(True)
Info 2021-11-15 10:02:29: Finished execution for 6bebbc1f-f99f-4bb9-a157-559b2f59f58c
Info 2021-11-15 10:02:29: stop debugging
Info 2021-11-15 10:02:29: Executing (and forget) (status Idle) silently Code = from debugpy import trace_this_thread;trace_this_thread(False)
Info 2021-11-15 10:02:32: Adding hash for 4 = a2c3aa35981f with 4 lines
Info 2021-11-15 10:02:32: Finished execution for d3e7e2fa-2393-4477-818e-9e3d4473871f
Info 2021-11-15 10:02:39: start debugging
Info 2021-11-15 10:02:39: connected to notebook during debugging
Info 2021-11-15 10:02:40: Executing (status Idle) silently Code = import debugpy;debugpy.wait_for_client()
Info 2021-11-15 10:02:40: Executing silently Code (completed) = import debugpy;debugpy.wait_for_client()
Info 2021-11-15 10:02:40: import startup: undefined
Info 2021-11-15 10:02:40: Executing (and forget) (status Busy) silently Code = from debugpy import trace_this_thread;trace_this_thread(False)
Info 2021-11-15 10:02:40: Adding hash for 5 = bea1735ac853 with 2 lines
Info 2021-11-15 10:02:40: Executing (and forget) (status Busy) silently Code = from debugpy import trace_this_thread;trace_this_thread(True)
Info 2021-11-15 10:02:44: Finished execution for 95b22618-1c7b-4a2e-a434-ab6aa5f34d85
Info 2021-11-15 10:02:44: stop debugging
Info 2021-11-15 10:02:44: Executing (and forget) (status Idle) silently Code = from debugpy import trace_this_thread;trace_this_thread(False)

@BradXiao BradXiao added the bug Issue identified by VS Code Team member as probable bug label Nov 15, 2021
@DonJayamanne
Copy link
Contributor

Thanks for reporting this issue.
I believe we have resolved this in our development branch.
Please could you install vscode insiders and test this out and let us know if it's fixed.

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster interactive-window Impacts interactive window interactive-window-debugging and removed needs-triage labels Nov 15, 2021
@BradXiao
Copy link
Author

Thanks for replying.

Environment data

  • VS Code version: 1.63.0-insider
  • Jupyter Extension version (available under the Extensions sidebar): 2021.11.1001452373
  • Python Extension version (available under the Extensions sidebar): 2021.11.1422169775
  • Others are the same.

The problem exists.

2021_11_15_10_40_09_477

@DonJayamanne
Copy link
Contributor

I'm sorry for not getting back to you on this.
We'll look into this issue, thanks.

@DonJayamanne DonJayamanne removed their assignment Nov 18, 2021
@DonJayamanne DonJayamanne removed the info-needed Issue requires more information from poster label Nov 18, 2021
@IanMatthewHuff
Copy link
Member

IanMatthewHuff commented Nov 24, 2021

Investigating this a bit now. For me this repro is only if black / comment lines are added. I think it might be our stripping code is not detecting the difference. If I add something like a = 100 above the def in cell A and then rerun then the lines do line up correctly.

Yeah, the full repro steps are not even needed. Just adding in the spaces before the def causes the issue.

@philippnoah
Copy link

Was this fixed? Think I just ran into this with an inline comment.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window interactive-window-debugging verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants