Wrong Code Highlighting in Jupyter Notebooks

Hello,

I tried to use PyCharm with Jupyter Notebooks. Everything is working fine, as far as I can tell, except the code highlighting. PyCharm in not attributing the right colours to keywords (for instance, def in not recognised, nor are strings or comments). Is there anyway to fix this? Code highlighting is working fine when editing regular python code.

Thanks.

1
8 comments

Are the cells being executed (interpreter is working correctly)? 

Please make sure that: 

- Notebook file is not in excluded folder

- .ipynb extension is registered as correct Notebook file type: https://www.jetbrains.com/help/pycharm/creating-and-registering-file-types.html#change-extension

If nothing helps, please provide some screenshots demonstrating the issue.

0
Avatar
Permanently deleted user

Yes, cells are being executed and code completion works great. The file is not in an excluded folder and the the correct extension is associated with Jupyter Notebooks, as can be seen in the screenshot below.

 

Here is an example of how the code looks in jupyter notebooks:

 

And here is an example of how regular code looks:

0

Does the issue reproduce for new notebooks / new projects?

0
Avatar
Permanently deleted user

Yes it is. Just tried a new project and it yield the same problem.

0

i have the same problem:

0

Hello, 

Please try starting the IDE with default setting though **File | Mange IDE Settings | Restore Default Settings**  and let me know if it works.

0
Avatar
Permanently deleted user

Had the same issue. Try to disable the Datalore plugin. I also disabled the Database tools and SQL plugin.

Good luck!

0

I had this happen to me too. I got syntax highlighting back by:

1. setting the kernal to "Python 3" from the dropdown menu at the top of the file
2. closing and reopening the ipynb file

0

Please sign in to leave a comment.