[vscode-jupyter] Fix `#%%` is not recognized as cell

by Andrew N.T.

Hero image

Photo by Isaac Smith

Table of Contents

  1. Context
  2. Solving the issue


Repo microsoft/vscode-jupyter. Jupyter is a notebook that allows writing markdown and executable Python source code in one file.

Issue #7829. The extension was expected to recognized #%% as a starting point for a new cell, but it didn't.

PR #7995

Solving the issue

I spent so much time trying to set up this project, mainly because I had never worked with Python before. My dev environment required a lot of installation for python ecosystem, and I ran into a few unfamiliar errors during the setup.

The errors looked simple at first, just a wrong regex as Rich, the maintainer, said. No matter how I changed the regex, still nothing changed at all. Luckily, I could trace the bug using breakpoints. Eventually, I came up with a fix, but it was much different from the initial discussion so I put a summary of my findings and let Rich help me decide on the solution.

folder structure of the experiment
folder structure of the experiment