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

Run by Line: disconnect at last line #6974

Merged
merged 13 commits into from
Aug 9, 2021
Merged

Conversation

DavidKutu
Copy link

For #6858

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

@DavidKutu DavidKutu requested a review from a team as a code owner August 5, 2021 18:45
@DavidKutu DavidKutu changed the title David/disconnect at last line Run by Line: disconnect at last line Aug 5, 2021
// 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');
Copy link
Contributor

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.

Copy link
Author

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');
Copy link
Contributor

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) {
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Author

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

Copy link
Author

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.

Copy link
Author

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-commenter
Copy link

codecov-commenter commented Aug 5, 2021

Codecov Report

Merging #6974 (c4236ef) into main (5c922c3) will decrease coverage by 0%.
The diff coverage is 10%.

❗ Current head c4236ef differs from pull request most recent head f5f903e. Consider uploading reports for the commit f5f903e to get more accurate results

@@          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     
Impacted Files Coverage Δ
src/client/debugger/jupyter/kernelDebugAdapter.ts 4% <10%> (-1%) ⬇️
src/client/common/cancellation.ts 72% <0%> (-4%) ⬇️
.../datascience/notebook/notebookControllerManager.ts 84% <0%> (-2%) ⬇️
src/client/datascience/jupyter/jupyterNotebook.ts 50% <0%> (-2%) ⬇️
src/client/common/application/webviews/webview.ts 67% <0%> (ø)
...lient/datascience/jupyter/kernels/cellExecution.ts 70% <0%> (+<1%) ⬆️
...t/datascience/notebook/vscodeNotebookController.ts 80% <0%> (+<1%) ⬆️
...client/datascience/kernel-launcher/kernelDaemon.ts 54% <0%> (+1%) ⬆️
...ient/datascience/kernel-launcher/kernelLauncher.ts 91% <0%> (+7%) ⬆️

@DavidKutu DavidKutu merged commit 0d2427f into main Aug 9, 2021
@DavidKutu DavidKutu deleted the david/disconnectAtLastLine branch August 9, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants