-
Notifications
You must be signed in to change notification settings - Fork 293
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
Run by Line: disconnect at last line #6974
Conversation
// Check if we're stopped at the last line | ||
let currentCell: NotebookCell | undefined; | ||
this.notebookDocument.getCells().forEach((cell) => { | ||
const index = sf.source?.path!.indexOf('#ch'); |
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 should be a helper function, give a stack we should find the corresponding cell.
I'm assuming we have similar code today elsewhere.
Also no idea what #ch
is here.
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.
I'll put it on a helper. The #ch
is to find the fragment in the stackFrame
// Check if we're stopped at the last line | ||
let currentCell: NotebookCell | undefined; | ||
this.notebookDocument.getCells().forEach((cell) => { | ||
const index = sf.source?.path!.indexOf('#ch'); |
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 code can go outside the forEach loop, this doesn't change, hence no need to get index & fragment everytime for each cell.
@@ -116,8 +117,11 @@ export class KernelDebugAdapter implements DebugAdapter, IKernelDebugAdapter { | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
const content = msg.content as any; | |||
if (content.event === 'stopped') { | |||
this.runByLineThreadId = content.body.threadId; | |||
this.runByLineSeq = content.seq; | |||
if (this.isRunByLine) { |
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.
Does this code work if i have a cell as follows:
def do_something():
print("Hello")
do_something()
Now, when I'm at the last line, will I be able to step in?
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.
Or what if i add a breakpoint at line print("Hello")
& then hit continue
, surely it shouldn't stop the run by line, but should step into that code.
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, I don't remember how it used to work, I'll check
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.
Looks like run by line in the webview doesn't work on stable. I'll go for it anyway.
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 new approach covers that scenario
Codecov Report
@@ Coverage Diff @@
## main #6974 +/- ##
=====================================
- Coverage 65% 64% -1%
=====================================
Files 361 361
Lines 22858 22865 +7
Branches 3431 3433 +2
=====================================
- Hits 14864 14861 -3
- Misses 6695 6703 +8
- Partials 1299 1301 +2
|
onDidChangeNotebookCellExecutionState event
…soft/vscode-jupyter into david/disconnectAtLastLine
For #6858
package-lock.json
has been regenerated by runningnpm install
(if dependencies have changed).