Skip to content

Conversation

DavidKutu
Copy link

For #4010

  • 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 review from a team and removed request for a team December 16, 2020 02:18
commandManager.registerCommand(Commands.NativeNotebookRunCellAndAllBelow, (uri) =>
this.runCellAndBelow(uri)
)
);
Copy link
Author

Choose a reason for hiding this comment

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

In old notebooks, the buttons are enabled only when the user selects a cell. In this case I don't know if we can do that.
We can create the context for it, but there's no event to keep it updated.

package.json Outdated
@@ -279,6 +279,26 @@
},
"enablement": "notebookViewType == jupyter-notebook && jupyter.isnotebooktrusted"
},
{
"command": "jupyter.notebookEditor.runallcellsabove",
Copy link
Member

Choose a reason for hiding this comment

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

From what I can see we don't camelCase any other command names. So should keep "notebookeditor" here for consistancy.

@@ -394,6 +394,8 @@
"DataScience.insertAbove": "Insert cell above",
"DataScience.addCell": "Add cell",
"DataScience.runAll": "Run all cells",
"DataScience.runAbove": "Run cells above",
Copy link
Member

Choose a reason for hiding this comment

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

We already have some command titles from the old code. Do any of the old strings work here so that we don't need to add new ones?

Copy link
Author

Choose a reason for hiding this comment

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

We never had, the ones on toolbar.tsx for example were returning a default.

There are messages for the command palette:
"jupyter.command.jupyter.runallcellsabove.palette.title": "Run Cells Above Current Cell",
"jupyter.command.jupyter.runcurrentcellandallbelow.palette.title": "Run Current Cell and Below",

Should I use those instead? They're a bit different

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, maybe just leave as is then. Keeps the native notebook stuff separate.

@@ -49,6 +49,8 @@ export namespace Commands {
export const RunAllCells = 'jupyter.runallcells';
export const RunAllCellsAbove = 'jupyter.runallcellsabove';
export const RunCellAndAllBelow = 'jupyter.runcellandallbelow';
export const NativeNotebookRunAllCellsAbove = 'jupyter.notebookEditor.runallcellsabove';
Copy link
Member

Choose a reason for hiding this comment

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

notebookEditor change to notebookeditor here as well.

return editor.selection.uri.toString();
}

return '';
Copy link
Member

Choose a reason for hiding this comment

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

I'd make this function return string or undefined. While '' can work as a "not found value" the undefined make it more clear that you have something valid any string is returned and something not valid if undefined. Even if both empty string and undefined are falsy.


cells.forEach(async (cell) => {
// 2 means code cell
if (cell.cellKind === 2) {
Copy link
Member

Choose a reason for hiding this comment

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

You can use the enum here I think:
vscodeNotebookEnums.CellKind.Code

Copy link
Member

@IanMatthewHuff IanMatthewHuff left a comment

Choose a reason for hiding this comment

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

David. Code looks solid here to me with a few small suggestions. I do think that we should see about adding in a .vscode. test here for this functionality. Hopefully isn't too hard to add, but the functionality here seems to need a test to go along with it.

Copy link
Contributor

@joyceerhl joyceerhl left a comment

Choose a reason for hiding this comment

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

Looks good. A vscode test could be helpful here.

@codecov-io
Copy link

codecov-io commented Dec 17, 2020

Codecov Report

Merging #4240 (7662e0e) into main (954d4bf) will increase coverage by 2%.
The diff coverage is 20%.

@@          Coverage Diff           @@
##            main   #4240    +/-   ##
======================================
+ Coverage     71%     73%    +2%     
======================================
  Files        384     384            
  Lines      25155   25206    +51     
  Branches    3598    3604     +6     
======================================
+ Hits       17931   18561   +630     
+ Misses      5826    5246   -580     
- Partials    1398    1399     +1     
Impacted Files Coverage Δ
...ient/datascience/interactive-ipynb/nativeEditor.ts 74% <0%> (-3%) ⬇️
src/client/datascience/notebook/notebookEditor.ts 6% <0%> (-1%) ⬇️
src/client/datascience/types.ts 100% <ø> (ø)
...e/interactive-ipynb/nativeEditorCommandListener.ts 50% <53%> (+11%) ⬆️
src/client/datascience/constants.ts 99% <100%> (+<1%) ⬆️
...e/raw-kernel/liveshare/guestRawNotebookProvider.ts 52% <0%> (-24%) ⬇️
...c/client/datascience/variablesView/variableView.ts 32% <0%> (-18%) ⬇️
...ce/raw-kernel/liveshare/hostRawNotebookProvider.ts 80% <0%> (-9%) ⬇️
...t/common/variables/environmentVariablesProvider.ts 77% <0%> (-4%) ⬇️
src/client/datascience/jupyter/jupyterSession.ts 82% <0%> (-4%) ⬇️
... and 74 more

test('Run cells above', async function () {
// This test is skipped because there is no way of selecting a cell in this context
// since by default the first cell is selected nothing happens when running all cells above
this.skip();
Copy link
Member

Choose a reason for hiding this comment

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

Looks good. I would just file the issue and then put the issue number here in the comment. That way when the test issue is resolved we know where to go to fix it. It's what we usually do for things like this.

David Kutugata added 2 commits December 17, 2020 15:00
nativeEditorCommandListener
@DavidKutu DavidKutu marked this pull request as ready for review December 18, 2020 00:06
@DavidKutu DavidKutu merged commit 6c215b1 into main Dec 18, 2020
@DavidKutu DavidKutu deleted the david/runAboveAndBelow branch December 18, 2020 00:35
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