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

put BP on first code line #7324

Merged
merged 4 commits into from
Aug 30, 2021
Merged

put BP on first code line #7324

merged 4 commits into from
Aug 30, 2021

Conversation

DavidKutu
Copy link

@DavidKutu DavidKutu commented Aug 27, 2021

Thanks @claudiaregio for finding this
for #7339

  • 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 27, 2021 23:55
const initialBreakpoint: DebugProtocol.SourceBreakpoint = {
line: 1
line: lineList[0] + 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all comments, what would happen here?

@@ -496,8 +498,21 @@ export class KernelDebugAdapter implements DebugAdapter, IKernelDebugAdapter, ID
await this.dumpCell(cell.document.uri.toString());

if (this.configuration.__mode === KernelDebugMode.RunByLine) {
const textLines = cell.document.getText().split('\r\n');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.splitLines({trim: false, removeEmptyEntries: false}) might be the safer option here.

@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2021

Codecov Report

Merging #7324 (8a50f76) into main (69ae8c3) will decrease coverage by 2%.
The diff coverage is 11%.

@@          Coverage Diff           @@
##            main   #7324    +/-   ##
======================================
- Coverage     65%     63%    -3%     
======================================
  Files        360     360            
  Lines      22553   22562     +9     
  Branches    3413    3415     +2     
======================================
- Hits       14788   14238   -550     
- Misses      6465    7139   +674     
+ Partials    1300    1185   -115     
Impacted Files Coverage Δ
src/client/debugger/jupyter/kernelDebugAdapter.ts 5% <11%> (+<1%) ⬆️
...ience/variablesView/variableViewMessageListener.ts 22% <0%> (-78%) ⬇️
...ent/common/application/webviewViews/webviewView.ts 14% <0%> (-72%) ⬇️
...c/client/datascience/variablesView/variableView.ts 17% <0%> (-62%) ⬇️
src/client/datascience/webviews/webviewViewHost.ts 21% <0%> (-58%) ⬇️
src/client/common/application/webviews/webview.ts 13% <0%> (-54%) ⬇️
src/client/datascience/themeFinder.ts 13% <0%> (-48%) ⬇️
src/client/datascience/codeCssGenerator.ts 16% <0%> (-44%) ⬇️
src/client/datascience/webviews/webviewHost.ts 47% <0%> (-31%) ⬇️
src/client/datascience/jupyter/jupyterNotebook.ts 21% <0%> (-30%) ⬇️
... and 23 more

line: lineList[0] + 1
};
const splitPath = cell.notebook.uri.path.split('/');
const name = splitPath[splitPath.length - 1];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the name of the notebook? If it is, then its clearer to use fs.baseName or similar API on cell.notebook.uri.fspath, instead of splitting with /.
E.g. on windows it could be \.

lines: [1],
breakpoints: [initialBreakpoint],
sourceModified: false
const textLines = cell.document.getText().splitLines({ trim: false, removeEmptyEntries: false });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here explaining why we need to parseForComments? I assume this is because before the breakpoint would end up on a commented line and not work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's it, will do

// Open variable view
const settings = this.settings.getSettings();
if (settings.showVariableViewWhenDebugging) {
await this.commandManager.executeCommand(Commands.OpenVariableView);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to await here?

@@ -496,31 +498,46 @@ export class KernelDebugAdapter implements DebugAdapter, IKernelDebugAdapter, ID
await this.dumpCell(cell.document.uri.toString());

if (this.configuration.__mode === KernelDebugMode.RunByLine) {
const initialBreakpoint: DebugProtocol.SourceBreakpoint = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should re-open #7251 or create a new issue to track the work around, else I do'nt see how we'll end up removing the work around.
I.e. theres no issue to track this work.

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 create a new one

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidKutu DavidKutu merged commit d90a2e4 into main Aug 30, 2021
@DavidKutu DavidKutu deleted the david/RBLfirstBP branch August 30, 2021 17:54
DavidKutu pushed a commit that referenced this pull request Aug 30, 2021
* put BP on first code line

* better way

* don't set a breakpoint if its all comments or empty
lines

* PR comments
DavidKutu pushed a commit that referenced this pull request Aug 30, 2021
* put BP on first code line

* better way

* don't set a breakpoint if its all comments or empty
lines

* PR comments
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.

5 participants