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

Collapsible Headings conflicts with Code prettify #767

Closed
lll9p opened this issue Oct 18, 2016 · 4 comments
Closed

Collapsible Headings conflicts with Code prettify #767

lll9p opened this issue Oct 18, 2016 · 4 comments

Comments

@lll9p
Copy link
Contributor

lll9p commented Oct 18, 2016

When I clicked the code formatting button, the errors below comes out.

TypeError: cell is null
http://localhost:6666/nbextensions/collapsible_headings/main.js?v=20161018093041
Line 80

firefox49.0.1
jupyter-contrib-nbextensions (0.2.1)
notebook (4.2.3)

@lll9p lll9p changed the title Code prettify conflicts with Collapsible Headings Collapsible Headings conflicts with Code prettify Oct 18, 2016
@jcb91
Copy link
Member

jcb91 commented Oct 18, 2016

this results from code_prettify attempting to select an undefined cell, as a result of the commented out line at src/jupyter_contrib_nbextensions/nbextensions/code_prettify/code_prettify.js#L127

jfbercher added a commit to jfbercher/jupyter_contrib_nbextensions that referenced this issue Oct 18, 2016
Removed index parameter in yapf_format function; instead get currently selected cell
@jfbercher
Copy link
Member

Indeed, there is another error in code_prettify; sorry for that.
There was some code remaining from a previous version where the index of the selected cell was passed to the yapf_format function. But actually the index is not defined anywhere anymore. That this actually works most of the time may be because since the index is undefined, then the select(index) does nothing and line 130 selects the correct cell.
I have just removed the reference to the index and corrected the code accordingly.
Tested on my configuration. Hope it will fix this.

@jcb91
Copy link
Member

jcb91 commented Oct 18, 2016

thanks @jfbercher, I think your diagnosis seems correct, and usually it works because selecting an undefined cell isn't a problem. As a result, I think it makes sense to fix this on the collapsible_headings side as well, as @lll9p has done in #768

jcb91 added a commit that referenced this issue Oct 18, 2016
Update code_prettify to address #767
@jcb91
Copy link
Member

jcb91 commented Oct 19, 2016

should now be fixed by #768, #770

@jcb91 jcb91 closed this as completed Oct 19, 2016
jcb91 pushed a commit to jcb91/jupyter_contrib_nbextensions that referenced this issue Dec 29, 2016
Removed index parameter in yapf_format function; instead get currently selected cell
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

No branches or pull requests

3 participants