-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Python 3.6 f-strings break notebook syntax highlighting #2037
Comments
It's an issue with Codemirror, the editor component. It has been fixed (codemirror/codemirror5#4182), but we had to stick with an old version of Codemirror to work around an issue with Safari (#2004). @gnestor @minrk what's the plan for getting back to a new version of Codemirror? Do we know if 5.22.1 fixes it? |
Thanks, at least the fix is trivial. Could we at least patch the existing Codemirror version? F-strings are the big ticket item in Python 3.6 after all. |
The JS files are built into one big concatenated file. We don't have a good way to carry patches against upstream JS projects, as far as I know. |
Ah that's a pity, but understandable @takluyver. I've just grep'ed all js files in |
Should be |
@gnestor the CodeMirror issue was closed, I think due to a comment that the bug wasn't reproducible outside the notebook. Does that mean it's due to our CSS somewhere? |
PatchTemporary solution tested on notebook version 4.3.1 Two patterns inside With sed:
|
@minrk @takluyver I just tested 5.22.2 in Safari and the same issue as before. @jasongrout fixed this in lab by updating the CSS. I tried changing @bede I can't find a |
@gnestor Lines 65, 73 and 188 of https://github.com/codemirror/CodeMirror/blob/97eb5221f05c09cfeafefa45b52da022fbcc46af/mode/python/python.js
|
I've marked this as 5.0 - I'd really like to get it fixed soon, because syntax highlighting is currently broken with the new Python 3.6 strings. Are we aware of any fix for the Safari issue in CodeMirror that would let us update it again? If not, can we work out a way to use a patched CodeMirror? |
@takluyver Agreed! I've spent some time investigating the Safari issue and what I've concluded is that it was introduced in CodeMirror 5.17. To quote from codemirror/codemirror5#4454 (comment):
I will keep trying to isolate the issue. If it's not resolved by 5.0 release time, let's try patching CodeMirror. |
Thanks for the detailed info on the patch! |
Ok, I've isolated this bug to this commit: codemirror/codemirror5@e60f4b7 We'll see if we can fix it on the CM side... @takluyver Any idea why this commit is causing this behavior? |
whats the recommended workaround for this? |
You can try @bede's patch: #2037 (comment) |
Notebook 4.3.2 was just published 👍 |
This should fix f string syntax highlighting jupyter#2037
Using Notebook v4.3.1, use of f-strings (PEP 498, Python 3.6) breaks syntax highlighting for the remaining code in a given cell.
Is Jupyter curently unable to handle this syntax? I would imagine that this issue would have been raised by others were this the case.
Using OS X, brewed Python 3.6.0, Firefox 50.
The text was updated successfully, but these errors were encountered: