ryantam626 / jupyterlab_code_formatter

A JupyterLab plugin to facilitate invocation of code formatters.
MIT License
822 stars 52 forks source link

JupyterLab 4(beta) support #299

Closed mcrutch closed 1 year ago

mcrutch commented 1 year ago

Since I have been down this road with some of my stuff already, figured I would give you a leg-up. Probably don't have the cycles to do a pull request/testing, but can at least give you some quick things to look at:

https://github.com/ryantam626/jupyterlab_code_formatter/blob/master/src/formatter.ts#L157 https://github.com/ryantam626/jupyterlab_code_formatter/blob/master/src/formatter.ts#L169 https://github.com/ryantam626/jupyterlab_code_formatter/blob/master/src/formatter.ts#L178 cell.model.value.text => cell.model.sharedModel.source

Probably similar on 221/238 of that file

https://github.com/ryantam626/jupyterlab_code_formatter/blob/master/src/formatter.ts#L89 const metadata = this.notebookTracker.currentWidget.content.model.metadata.toJSON(); => const metadata = this.notebookTracker.currentWidget.content.model.sharedModel.metadata

ryantam626 commented 1 year ago

Thanks for the heads up!

Just out of curiosity, would these changes be backward compatible?

mcrutch commented 1 year ago

From my testing they worked with 3.6.1 but not 3.5. So 3.6.x+ should be good unless my test environment was screwy. (My discovery process - https://discourse.jupyter.org/t/understanding-jupyterlabv4-notebook-v7-changes-with-inotebooktrackers-and-activecells/18563)

ryantam626 commented 1 year ago

Thank you so much, this is perfect :raised_hands: