Copilot++ Not Behaving Properly with Jupyter Notebooks

For context: I use Cursor (Pro subscription) to develop in python. I work in Jupyter notebooks (.ipynb files) and also normal python files (.py files) which I use as libraries.

As of July 1, 2024, the auto-suggestions provided by Copilot++ have not been working as usual in my Jupyter notebooks.

Usually, the code suggestions are relevant to the code I am writing (example: suggesting appropriate next lines, completing loops, or filling out docstrings according to a function I just wrote).

Now the code suggestions are lines of code that are slightly above the cursor. For one notebook I was investigating, I noticed that it always suggested to replace/insert the line(s) of code that are 8 lines up in the notebook (this happens within cells and across cells, and it even suggests markdown lines in a python code cell). In another notebook, it’s always suggesting the lines at are around 14 lines above. In some other notebooks, Copilot++ works normally.

In my .py files, it’s working normally.

In investigating for this forum post, I found some partial fixes:

  1. In the first couple code cells in the notebook, Copilot++ works normally.

  2. I had an import (“from scipy.optimize import fsolve”) in a cell midway down the notebook. Moving this to the code cell near the beginning (with all the other imports) seemed to help: Copilot++ works normally further in to the notebook, but still suggests existing lines of code further down.

The request ids of some erroneous Copilot++ responses (with privacy mode turned off):

I think this bug is related (or the same) to the one brought up in this thread: Copilot++ Suggesting Markdown in Code Blocks/Other Extremely Wrong Things

I’ve tried the fixes they tried (restarting/trying to update cursor; turning Copilot++ off and on; fast and legacy modes) with no noticeable changes.

Please let me know if you would like any other information so that I can help with resolving this bug.

I did some further investigations into this bug and found a partial, inconsistent fix (and a possible mechanism for what’s going on).

In Markdown boxes in a Jupyter notebook, TeX delimiters for inline math ($ … $) can cause Copilot++ to suggest repeated code (from a few lines above the cursor) in following cells in the notebook. This seems to apply to header and body markdown text.

I think this is why some notebooks don’t have this issue (they didn’t have any LaTeX math), and why python libraries don’t either.

The (inconsistent) fix: Replacing these with the TeX delimiters for displayed math ($$ … $$) seems to solve this issue. After doing this, Copilot++ tends to work like normal in the following code cells.


  1. Turning the '$$'s back to '$'s doesn’t always cause Copilot++ to behave improperly again. Sometimes it keeps working normally.
  2. Sometimes turning '$'s to '$$'s doesn’t fix Copilot++ behavior in the cells immediately after. It’s possible that any ($ … $) pairs anywhere in the notebook cause it to behave abnormally in other regions of the notebook. I haven’t noticed any patterns apart from this.
  3. Sometimes, it’s not working in a cell, but after prompting a code suggestion at another point in that same cell, that suggestion is normal, and then a suggestion further down the cell is normal as well.

These patterns are not fully consistent, but they may help other users, and the developers to troubleshoot this. I hope this is helpful.

I’m currently on version:

I can confirm that Copilot++ also doesn’t work in notebooks in Cursor version

Removing all '$'s and '$$'s in markdown does seem to fix the issue though. When they are in code blocks (such as in a string) there doesn’t seem to be a problem.

Can I please request a download link for an older version of Cursor?

Such as 0.35.0, I think that was before Copilot++ started causing problems.

I’m on windows 64-bit.