Skip to content

Implement IJupyterVariables for the debugger - #11543

Merged
Rich Chiodo (rchiodo) merged 14 commits into
masterfrom
rchiodo/debugger_variable
May 4, 2020
Merged

Implement IJupyterVariables for the debugger#11543
Rich Chiodo (rchiodo) merged 14 commits into
masterfrom
rchiodo/debugger_variable

Conversation

@rchiodo

Copy link
Copy Markdown

For #11542

I need this work for the Run By Line mvp and part of implementing it will work for both interactive and the run by line, so I did this first.

@codecov-io

Codecov (codecov-io) commented May 1, 2020

Copy link
Copy Markdown

Codecov Report

Merging #11543 into master will increase coverage by 0.06%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11543      +/-   ##
==========================================
+ Coverage   60.45%   60.51%   +0.06%     
==========================================
  Files         618      617       -1     
  Lines       33774    33609     -165     
  Branches     4763     4727      -36     
==========================================
- Hits        20419    20340      -79     
+ Misses      12347    12287      -60     
+ Partials     1008      982      -26     
Impacted Files Coverage Δ
...ess/internal/scripts/vscode_datascience_helpers.ts 33.33% <ø> (ø)
...ient/datascience/interactive-ipynb/nativeEditor.ts 11.61% <ø> (ø)
...atascience/interactive-window/interactiveWindow.ts 15.62% <ø> (ø)
src/client/datascience/types.ts 100.00% <ø> (ø)
src/client/datascience/webViewHost.ts 9.25% <0.00%> (-0.06%) ⬇️
...c/datascience-ui/react-common/settingsReactSide.ts 22.22% <ø> (ø)
.../datascience/interactive-common/interactiveBase.ts 5.59% <25.00%> (-0.03%) ⬇️
src/client/datascience/data-viewing/dataViewer.ts 25.00% <66.66%> (ø)
src/client/common/experimentGroups.ts 100.00% <100.00%> (ø)
src/client/datascience/constants.ts 99.73% <100.00%> (+0.01%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0158c3...a8c3557. Read the comment docs.

// Licensed under the MIT License.
'use strict';
import type { nbformat } from '@jupyterlab/coreutils';
import type { JSONObject } from '@phosphor/coreutils';

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This file is what used to be jupyterVariables. I didn't change it at all. It is used if the run by line experiment is turned off.

// Run the get dataframe rows script
if (!this.debugService.activeDebugSession) {
// No active server just return the unchanged target variable
return {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wouldn't this be targetVariable? Based on the comment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah it shoudl be. I'll fix it.


In reply to: 418774471 [](ancestors = 418774471)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually no, the comment is just wrong. I'll fix the comment. This is the row data. If it can't be fetched, it should return an empty json object.


In reply to: 418778956 [](ancestors = 418778956,418774471)

// If using the interactive debugger, update our variables.
if (message.type === 'response' && message.command === 'variables') {
// tslint:disable-next-line: no-suspicious-comment
// TODO: Figure out what resource to use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just checking (since I use TODOs like this as well) this is something that is planned for a later checkin. Not something that you need now?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It works right now, so not worrying about it. But at some point yes. I need to somehow figure out the active resource. It's messy though. The debug service doesn't have the concept of a file that it's debugging. Maybe the filtering for variables should be done at a different location.


In reply to: 418775579 [](ancestors = 418775579)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lots to review, will re-visit on monday.

@inject(IJupyterVariables) @named(Identifiers.DEBUGGER_VARIABLES) private debugVariables: DebugAdapterTracker
) {}
public activate(): Promise<void> {
this.disposables.push(this.debugService.registerDebugAdapterTrackerFactory('python', this));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We have a constant for python. I think its PYTHON_LANGUAGE or something. Please could we use that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure


In reply to: 418782898 [](ancestors = 418782898)

_notebook: INotebook,
start: number,
end: number
): Promise<JSONObject> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do we need to use JSONObject, why not just {} or some other type?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah I guess it doesn't need that. It was that way before. I'll change it as that's much simpler.


In reply to: 418783160 [](ancestors = 418783160)

@DonJayamanne

Copy link
Copy Markdown

And thanks for splitting the PR.

data: {
executionCount: arg.prevState.currentExecutionCount,
sortColumn: 'name',
sortAscending: true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this clearing sort order on refresh? I would think that would stay from the previous state.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We don't support sorting anymore


In reply to: 418960482 [](ancestors = 418960482)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Forgot about that. Sounds good.

@sonarqubecloud

sonarqubecloud Bot commented May 4, 2020

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 12 Security Hotspots to review)
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

constructor(
@inject(IDebugService) private debugService: IDebugService,
@inject(IDisposableRegistry) private disposables: IDisposableRegistry,
@inject(IJupyterVariables) @named(Identifiers.DEBUGGER_VARIABLES) private debugVariables: DebugAdapterTracker

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I love this... simple OOP, simple abstraction and now yay we have a new implementation.

@rchiodo
Rich Chiodo (rchiodo) merged commit 8633a8d into master May 4, 2020
@rchiodo
Rich Chiodo (rchiodo) deleted the rchiodo/debugger_variable branch May 4, 2020 19:51
@lock lock Bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants