for some background, I usually use vscode for creating input for my calculation, especially using the jupyter notebook extension to my WSL Ubuntu. so I’ve been setting up my vscode using standard Python and Jupyter noteboook extensions. Everything looked good and ran smoothly as the day before until two days ago (29-02-2024) when I was modifying my input and the python IntelliSense started not responding and syntax highlight was not responding.
At first, I thought maybe my Python kernel shutting down so I reconnected it to my standard Python at /bin/python3, and nothing was changed, so I restarted my vscode with the hope that everything back again with a clean start. It seems to work since the script I added as the previous session (before closing) has been colored with proper syntax highlights, but when I add the next syntax, commenting, the highlights don’t work and all syntax isn’t colored properly. It looks like the color came from the previous line or line after that like it was locked for each line with the color loaded during the first opening of my jupyter notebook.
as an example, this is my dummy syntax on the notebook cell when I loaded my notebook
and this is when I modified it slightly by deleting some dummy comments, the color highlights are not working properly. It all also happened when I added another syntax to the cell.
deleting dummy comments and typing syntax
this is my extension used right now
Hence, I thought it was a problem with my extension since when I restart my vscode, it gives me some notification regarding the February 2024 update. So I removed and reinstalled my Python and jupyter notebook extensions either on the local or remote WSL side, and nothing worked.
I am also surfing through some StackOverflow feeds and vscode forum, trying some of the others’ recommendations in comment sections, been reinstalling my vscode after clean uninstalled my vscode from my Windows side (deleting %APPDATA%Code and %USERPROFILE%.vscode folders) and also from the WSL side (~/.vscode-server), nothing changes on the syntax highlights on my ipynb.
Some comment sections also talk about disabling Dependency Analytics, but I haven’t used Dependency Analytics before.
On a mission to specify which part of my vscode setup that broken, I tried to modify other ipynb files, and it still didn’t work. But, when I check my ipynb file on another PC at the office, it can work properly there.
Other findings were the problem with syntax highlights, intellisense, and autocorrection/autocomplete only happened on my jupyter notebook on the WSL Ubuntu side. The highlights of ipynb worked properly on the local Windows side but since the program that I need is on the WSL side, then the intellisense will not work properly, but at least the highlights work on Windows side.
I also try to check my python.py script on the WSL side, and the syntax highlights … work perfectly. So this should be the problem specific to WSL Ubuntu, especially on jupyter notebook settings of vscode.
additional info, I have tried to install another Linux distribution from WSL and try to connect using vscode and the problem with ipynb still exists. So I think there must be some problem with the vscode specifically on jupyter notebook settings on syntax highlights and intelisense.
So, the question is, which part of my vscode needs to be checked so I can get all of my jupyter notebook features to be fully operated normally as it was before? I need some insight since I think even a complete reinstall of my WSL Ubuntu (literally get rid of WSL from Windows, including the WSL2kernel, then reinstalling everything, starting from reinstalling the WSL2 kernel, then the Ubuntu, build-essential, etc) still didn’t help me at this point. Now, I only use the Developer: Reload Window command to reload my vscode window after modifying my ipynb.
other info:
- vscode version 1.87.0
- 019f4d1419fbc8219a181fab7892ebccf7ee29a2
- x64
- WSL2 Ubuntu
- extension used on WSL side: isort, Jupyter, Jupyter Cell Tags, Jupyter Notebook, Jupyter Slide Show, Pylance, Python, Python Debugger, Jupyter Keymap
2
Answers
I have the same problem with syntax highlighting . I’m working with Jupyter notebooks with a virtual environment on WSL. Here are the details of my VS Code install:
WSL details:
I haven’t tried anything yet to alleviate this problem but I hope these informations can help narrow down the origin of this bug.
According to this reply in github, the fix will come in the stable recovery release 1.87.1.
You can either wait or try an older version of VSCode, such as vscode v1.86.2