GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add setting jupyter.newCellOnRunLast by janosh · Pull Request #7995 · microsoft/vscode-jupyter

Conversation

@janosh

@janosh Janosh Riebesell (janosh) commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

For #7966.

Went ahead and took a swing at adding a setting to disable appending a new empty cell to IW files when running the last cell. Not sure how successfully tbh. Is runCurrentCellAndAddBelow() the right function to modify? If so, should we rename it to runCurrentCellAndMaybeAddBelow?

  • 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).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kleinicke reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@janosh
Janosh Riebesell (janosh) requested a review from a team as a code owner October 21, 2021 18:42
rchiodo
Rich Chiodo (rchiodo) approved these changes Oct 21, 2021
View reviewed changes
@rchiodo

Rich Chiodo (rchiodo) commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Thanks Janosh Riebesell (@janosh). Looks good to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Looks like some of the test files are failing to build. Your new setting isn't in the dummy test configs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@janosh Janosh Riebesell (janosh) mentioned this pull request Oct 21, 2021
runCurrentCellAndAdvance only advance if jupyter.enableAutoMoveToNextCell #7997
Closed
5 of 9 tasks
@IanMatthewHuff

Ian Huff (IanMatthewHuff) commented Oct 21, 2021

Copy link
Copy Markdown
Member

I think that I'm fine with this setting (since I do add that cell on accident myself from time to time), but ctrl-enter does exist for this scenario already which is what I usually use. Feels a little funny to have a setting just to basically map shift-enter => ctrl-enter in a specific scenario. I think I like it though, not like an extra setting hurts much.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@IanMatthewHuff
Ian Huff (IanMatthewHuff) self-requested a review October 21, 2021 20:05
IanMatthewHuff
Ian Huff (IanMatthewHuff) approved these changes Oct 21, 2021
View reviewed changes
@janosh

Janosh Riebesell (janosh) commented Oct 21, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Oh, I didn't know about ctrl + enter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DonJayamanne

Don Jayamanne (DonJayamanne) commented Oct 21, 2021

Copy link
Copy Markdown
Contributor

Thanks Janosh Riebesell (@janosh) for the PR.

However I'm not yet convinced we should be adding these two settings.
Would like to discuss this with the rest of the team along with #7995 once again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DonJayamanne Don Jayamanne (DonJayamanne) closed this Oct 21, 2021
@janosh

Janosh Riebesell (janosh) commented Oct 22, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Don Jayamanne (@DonJayamanne) I agree there's no need for #7997 but still think this would be nice to have. Even knowing about ctrl+enter I expect I'll continue to hit shift+enter occasionally out of habit. This then adds new empty cells to files I didn't not mean to modify which in turn causes commit hooks to complain, requiring me to revert the offending files. So I find the current cell-adding behavior a bit of a hassle and would like to disable it completely.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

This one seems different to me. I think we should reopen it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo Rich Chiodo (rchiodo) reopened this Oct 22, 2021
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Oct 22, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #7995 (a1ee60c) into main (cd7931d) will decrease coverage by 0%.
The diff coverage is 25%.

@@          Coverage Diff          @@
##            main   #7995   +/-   ##
=====================================
- Coverage     70%     70%   -1%     
=====================================
  Files        367     367           
  Lines      22613   22616    +3     
  Branches    3429    3430    +1     
=====================================
- Hits       16041   16032    -9     
- Misses      5189    5193    +4     
- Partials    1383    1391    +8     
Impacted Files Coverage Δ
src/client/common/types.ts 100% <ø> (ø)
src/client/common/utils/localize.ts 95% <ø> (ø)
...ient/datascience/editor-integration/codewatcher.ts 68% <0%> (-1%) ⬇️
src/client/common/configSettings.ts 86% <100%> (+<1%) ⬆️
...datascience/editor-integration/codelensprovider.ts 69% <0%> (-2%) ⬇️
...client/datascience/kernel-launcher/kernelDaemon.ts 56% <0%> (-2%) ⬇️
src/client/datascience/baseJupyterSession.ts 71% <0%> (-2%) ⬇️
src/client/datascience/jupyter/kernelVariables.ts 56% <0%> (-2%) ⬇️
...lient/datascience/jupyter/kernels/cellExecution.ts 76% <0%> (-2%) ⬇️
...datascience/jupyter/liveshare/hostJupyterServer.ts 67% <0%> (-1%) ⬇️
... and 2 more
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DonJayamanne

Don Jayamanne (DonJayamanne) commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

Ooops, sorry I didn't mean to close this, I only meant to update it with my comments. Apologies for that.
Lets discuss in the triage meeting. If anything I'd like the issue to be left open and wait for community upvotes,

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DonJayamanne
Don Jayamanne (DonJayamanne) previously requested changes Oct 22, 2021
View reviewed changes

@DonJayamanne Don Jayamanne (DonJayamanne) left a comment

Copy link
Copy Markdown
Contributor

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.

Blocking so we discuss this in triage meeting

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rchiodo
Rich Chiodo (rchiodo) dismissed Don Jayamanne (DonJayamanne)’s stale review October 25, 2021 20:26

Triage agreed to take this

@rchiodo

Rich Chiodo (rchiodo) commented Oct 25, 2021

Copy link
Copy Markdown
Contributor

Janosh Riebesell (@janosh) we agreed to take this one, but I think it's breaking some of the tests. Specifically this one might be related to your change:

  Leading whitespace not suppressed:1 | Output does not contain provided text '	ho 	ho 	ho ' for Cell 1, it is <No cell outputs>

Can you try that locally?

You can do that inside VS code (if you run with insiders), by running this launch config:

image

And changing the launch config to use a grep:

        {
            "name": "VS Code Tests (Jupyter+Python Extension installed, *.vscode.test.ts)",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "${workspaceFolder:vscode-jupyter}/src/test/datascience",
                "--enable-proposed-api",
                "--extensionDevelopmentPath=${workspaceFolder}",
                "--extensionTestsPath=${workspaceFolder}/out/test"
            ],
            "env": {
--->           "VSC_JUPYTER_CI_TEST_GREP": "Check diagnostics with and without an import", // Modify this to run a subset of the tests
                "VSC_JUPYTER_CI_TEST_INVERT_GREP": "", // Initialize this to invert the grep (exclude tests with value defined in grep).
                "CI_PYTHON_PATH": "<PythonPath>", // Update with path to real python interpereter used for testing.
                "VSC_FORCE_REAL_JUPYTER": "true", // Enalbe tests that require Jupyter.
                "VSC_JUPYTER_CI_RUN_NON_PYTHON_NB_TEST": "", // Initialize this to run tests again Julia & other kernels.
                "VSC_JUPYTER_RUN_NB_TEST": "1", // Initialize this to run notebook tests (must be using VSC Insiders).
                "VSC_JUPYTER_LOAD_EXPERIMENTS_FROM_FILE": "true",
                "TEST_FILES_SUFFIX": "vscode.test",
                "VSC_JUPYTER_EXPOSE_SVC": "1"
            },
            "stopOnEntry": false,
            "sourceMaps": true,
            "outFiles": ["${workspaceFolder}/out/**/*.js", "!${workspaceFolder}/**/node_modules**/*"],
            "preLaunchTask": "Compile",
            "skipFiles": ["<node_internals>/**"],
            "presentation": {
                "group": "2_tests",
                "order": 5
            }
        },

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

DonJayamanne
Don Jayamanne (DonJayamanne) approved these changes Oct 25, 2021
View reviewed changes
@rchiodo Rich Chiodo (rchiodo) mentioned this pull request Oct 26, 2021
Run Cell codelens action modifies file #8039
Closed
@rchiodo

Rich Chiodo (rchiodo) commented Oct 26, 2021

Copy link
Copy Markdown
Contributor

You might also just try rebasing against our main branch. Don has fixed a bunch of the tests that were failing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Janosh Riebesell (janosh) added 2 commits October 26, 2021 18:25
@janosh
add setting jupyter.newCellOnRunLast
fd91eb1
@janosh
fix CI error TS2420: Property 'newCellOnRunLast' is missing in type '…
a1ee60c
…JupyterSettings' but required in type 'IWatchableJupyterSettings'
@janosh

Janosh Riebesell (janosh) commented Oct 26, 2021

Copy link
Copy Markdown
Contributor Author

Rich Chiodo (@rchiodo) Did the rebase. Workflows awaiting approval.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@janosh

Janosh Riebesell (janosh) commented Oct 27, 2021

Copy link
Copy Markdown
Contributor Author

Sadly tests are still failing. They're also difficult to make sense of. "Run tests with VSCode & Jupyter" is the one affected and it has a mile-long output. Not sure what the actual error is.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Oct 27, 2021

Copy link
Copy Markdown
Contributor

Close enough. I think those two tests are flakey.

Thanks so much for the PR. I'm going to submit.

If you happen to help us again, and tests fail, you can look in the publish test results item to see which test failed:

image

janosh reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo
Rich Chiodo (rchiodo) merged commit 3de609d into microsoft:main Oct 27, 2021
@rchiodo

Rich Chiodo (rchiodo) commented Oct 27, 2021

Copy link
Copy Markdown
Contributor

Oh whoops, there's no news item. I'll add a PR shortly with your fix.

janosh reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Oct 27, 2021

Copy link
Copy Markdown
Contributor

Added a commit directly with the news item:
bd2d62a#diff-15ec3520a6c835df7ee611f3fa1dd1e0117da936621083ce38df337269389426

Thanks again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gregvanl Greg Van Liew (gregvanl) mentioned this pull request Oct 29, 2021
Change logs for Jupyter release October 2021 microsoft/vscode-docs#4922
Merged
@janosh

Janosh Riebesell (janosh) commented Nov 12, 2021

Copy link
Copy Markdown
Contributor Author

This setting doesn't actually work, new cells are appended on running the last even when set to false. Probably should have added a test as well. Am I fetching the setting the right way? I just copied

const { newCellOnRunLast } = this.configService.getSettings(this.documentManager.activeTextEditor.document.uri);

from another place in the code by analogy.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Nov 12, 2021

Copy link
Copy Markdown
Contributor

Yeah that looks correct to me.

I debugged it a bit. I think the check is in the wrong spot.

I believe it should be here:

vscode-jupyter/src/client/datascience/editor-integration/codewatcher.ts

Line 343 in 796361a

return this.runMatchingCell(this.documentManager.activeTextEditor.selection, true);

Instead of passing true for the 'advance' parameter, it should check the setting you added.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@janosh

Janosh Riebesell (janosh) commented Nov 12, 2021

Copy link
Copy Markdown
Contributor Author

Rich Chiodo (@rchiodo) Thanks for taking a look and sorry for getting this wrong. I think the true there must stay and instead we need to check in runMatchingCell if newCellOnRunLast is true in which case we don't do anything in the else case:

vscode-jupyter/src/client/datascience/editor-integration/codewatcher.ts

Lines 1042 to 1048 in 796361a

} else {
// insert new cell at bottom after current
const editor = this.documentManager.activeTextEditor;
if (editor) {
this.insertCell(editor, currentRunCellLens.range.end.line + 1);
}
}

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rchiodo

Rich Chiodo (rchiodo) commented Nov 12, 2021

Copy link
Copy Markdown
Contributor

Yeah that seems better. I was thinking we only wanted to apply the setting on the SHIFT+ENTER case, but we should apply it on the 'runcell' code lens too (which I believe is the other case that has advance == true)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@janosh Janosh Riebesell (janosh) mentioned this pull request Nov 12, 2021
fix newCellOnRunLast #8256
Merged
2 of 9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@IanMatthewHuff Ian Huff (IanMatthewHuff) IanMatthewHuff approved these changes
@DonJayamanne Don Jayamanne (DonJayamanne) DonJayamanne approved these changes
@rchiodo Rich Chiodo (rchiodo) rchiodo approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@janosh @rchiodo @IanMatthewHuff @DonJayamanne @codecov-commenter
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.