jupyterlab_code_formatter
jupyterlab_code_formatter copied to clipboard
auto format when save
Hi there, can we set it to auto format code when auto save the notebook?
Hello! There is no setting to support this at the moment, I agree this is something useful and will work on this when I get more free time! (PR always welcomed though :stuck_out_tongue: )
Thank you for response
@SolarisYan Any ideas on how this could be implemented?
(I don't know if it's possible to use a @jupyterlab
extension to hook into whatever code is called when a user leaves a cell.)
@sebinsua In fact, i have no idea about that, and i think it's possible to use a hook to solve it.
I created a trailing space remover extension, which works on notebook save event.
You can check how I implemented it: https://github.com/wallneradam/jupyterlab-trailing-space-remover
It was very hard to find how to listen on save event. My 1st version used a closure on toJSON method. But the final solution is much better.
Also you can use the following to get an event, when active cell is changed: http://jupyterlab.github.io/jupyterlab/notebook/interfaces/inotebooktracker.html#activecellchanged
The developer documentation is very poor. The same as PhosphorJS. Both were written very well, to make easy to create plugins, but without documentation it is very hard to do it. The only way I found is to read the packages folder under JupyterLab source, where there are a lot of examples.
I created a trailing space remover extension, which works on notebook save event.
You can check how I implemented it: https://github.com/wallneradam/jupyterlab-trailing-space-remover
It was very hard to find how to listen on save event. My 1st version used a closure on toJSON method. But the final solution is much better.
Also you can use the following to get an event, when active cell is changed: http://jupyterlab.github.io/jupyterlab/notebook/interfaces/inotebooktracker.html#activecellchanged
The developer documentation is very poor. The same as PhosphorJS. Both were written very well, to make easy to create plugins, but without documentation it is very hard to do it. The only way I found is to read the packages folder under JupyterLab source, where there are a lot of examples.
Ooo thanks for the tip! This should help
FYI: https://jupyter-notebook.readthedocs.io/en/stable/extending/savehooks.html
Closed by #195?
Closed by #195?
Bingo, I haven't been doing house cleaning at all, closing now.