Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Jupyter Extension: Rich syntax highlighting not working?

I've just had to start from a fresh setup thanks to equipment failure, and this means configuring VSCode from scratch again. On my old set-up, Jupyter Notebooks (over SSH) would feature rich syntax highlighting identical to that used in raw .py files (photo 1):

Raw .py syntax highlighting

However, in Jupyter notebooks, Pylance and intellisense work (I can mouseover and complete variables), but the rich syntax highlighting never does (photo 2): ipynb lack of syntax highlighting

This worked perfectly fine on my old system, and I was using the Dark+ theme as I am here. Any ideas as to what could be the cause of this? Many thanks all.

Things I have tried:

  • Uninstalling and reinstalling the Python and Jupyter extensions both locally and remote;
  • Changing theme;
  • Connecting to a different SSH host (the issue persists).

VSCode 1.60.0 (but the issue was also there in 1.59.x)

like image 573
LittleKingJohn Avatar asked Sep 03 '21 14:09

LittleKingJohn


People also ask

How do I enable Jupyter Notebook extensions in VS Code?

Installing the Jupyter Extension First, launch your VS Code and type “jupyter notebook” in the extension search box. Select the first result (Jupyter) and click on the Install button displayed in the middle of the screen: That's it! Once the installation is done, you already have Jupyter Notebook on your VS Code.

How do I change syntax highlighting in VS Code?

To change the text and syntax colors in visual studio code follow the steps given below: Open VS Code editor to change the syntax colors. Go to Settings, which is on the bottom left corner of the VS Code window. In the search field type JSON, and click on the 'Edit in settings.

Does Jupyter Notebook have syntax highlighting?

Upon launching the notebook, there is syntax highlighting (I am guessing default syntax highlighting for Python). As soon as it connects to the Julia kernel, there is no syntax highlighting at all.

Does VS Code support Jupyter Notebook?

Jupyter Notebooks in VS Code. Jupyter (formerly IPython Notebook) is an open-source project that lets you easily combine Markdown text and executable Python source code on one canvas called a notebook. Visual Studio Code supports working with Jupyter Notebooks natively, and through Python code files.

Does Visual Studio Code support Jupyter notebooks?

Visual Studio Code supports working with Jupyter Notebooks natively, and through Python code files. This topic covers the native support available for Jupyter Notebooks and demonstrates how to:

How do I use the vs code debugger with Jupyter?

Once exported as a Python file, the VS Code debugger lets you step through your code, set breakpoints, examine state, and analyze problems. Using the debugger is a helpful way to find and correct issues in notebook code. To debug your Python file: In VS Code, if you haven't already, activate a Python environment in which Jupyter is installed.

How do I change the language of my Jupyter Notebook code?

After selecting a kernel, the language picker located in the bottom right of each code cell will automatically update to the language supported by the kernel. If you have an existing Jupyter Notebook, you can open it by right-clicking on the file and opening with VS Code, or through the VS Code File Explorer.

How do I view variables in a Jupyter Notebook?

Within a Python Notebook, it's possible to view, inspect, sort, and filter the variables within your current Jupyter session. By selecting the Variables icon in the main toolbar after running code and cells, you'll see a list of the current variables, which will automatically update as variables are used in code.


Video Answer


2 Answers

It can happen because there is conflict with Dependency Analytics extension with jupyter. Try to disable Dependency Analytics extension

like image 167
Arif Avatar answered Oct 21 '22 04:10

Arif


I had the same problem and I solved it by switching from "Dark" theme to "Dark+".

like image 33
Christopher Seander Avatar answered Oct 21 '22 04:10

Christopher Seander