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

Format cell on run like the nb_black extension does. #7058

Closed
nickeubank opened this issue Aug 10, 2021 · 12 comments · Fixed by microsoft/vscode#182924
Closed

Format cell on run like the nb_black extension does. #7058

nickeubank opened this issue Aug 10, 2021 · 12 comments · Fixed by microsoft/vscode#182924
Assignees
Labels
feature-request Request for new features or functionality notebook-workflow Issues that interrupt expected or desirable behavior on-testplan

Comments

@nickeubank
Copy link

One of my favorite features of vscode (and other good editors) is format on save. Obviously that's not feasible for notebooks because they aren't linear and so a formatter would struggle if it tried to parse everything every time the notebook was saved. But there is a solution that's like format on save for notebooks: format on run.

Now that notebook cells can be formatted, would it be possible to create a setting where each cell is formatted when it's run? It's already available in regular jupyter notebooks thanks to nb_black, and I'd love to see it in VS code notebooks.

@rchiodo
Copy link
Contributor

rchiodo commented Aug 10, 2021

Thanks for the suggestion. We'll look at it in our weekly triage. It will probably need a bunch of upvotes before it's considered.

@nickeubank
Copy link
Author

Thanks! Since black catches syntax errors, it's kinda related to this too, no? #1482

@dwSun
Copy link

dwSun commented Aug 11, 2021

+1 code format inside cell is the last reason I still keep jupyter-lab on my system.

@greazer greazer added awaiting-community-thoughts notebook-workflow Issues that interrupt expected or desirable behavior and removed needs-triage labels Aug 12, 2021
@greazer greazer changed the title ENH: Format-cell-on-run like nb_black Format cell on run like the nb_black extension does. Aug 12, 2021
@MarcoGorelli
Copy link

@jucor
Copy link

jucor commented Oct 9, 2021

That would be very helpful indeed! Thanks for considering!

@alonme
Copy link

alonme commented Apr 19, 2022

Any news regarding this?

I would personally prefer to have the formatting done on save, and not when running a cell.

@rchiodo
Copy link
Contributor

rchiodo commented Apr 19, 2022

Sorry but it's not planned at the moment.

@movy
Copy link

movy commented Sep 18, 2022

Spent 1/2 hour trying to figure out why it's not working... some hint in the config section would be nice.

@smoochy
Copy link

smoochy commented Feb 20, 2023

Could you please reconsider this again?

Cheers.

@sa2812
Copy link

sa2812 commented Apr 27, 2023

You can add the "notebook.formatOnSave.enabled": true setting as found here.

@Yoyokrazy
Copy link
Contributor

This feature will be in the next insiders build, and can be enabled by adding the following into your settings json:
"notebook.formatOnCellExecution": true

@jucor
Copy link

jucor commented May 22, 2023 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality notebook-workflow Issues that interrupt expected or desirable behavior on-testplan
Projects
None yet
Development

Successfully merging a pull request may close this issue.