F2 rename variable doesn't work in vscode + jupyter notebook + python

Question:

I can use the normal F2 rename variable functionality in regular python files in vscode. But not when editing python in a jupyter notebook.

When I press F2 on a variable in a jupyter notebook in vscode I get the familiar change variable window but when I press enter the variable is not changed and I get this error message:

No result. No result.

Is there a way to get the F2 change variable functionality to work in jupyter notebooks?

Here’s my system info:

jupyter module version

(adventofcode) C:gitleetcode>pip show jupyter
Name: jupyter
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: [email protected]
License: BSD
Location: c:usersjohananaconda3envsadventofcodelibsite-packages
Requires: ipykernel, qtconsole, nbconvert, jupyter-console, notebook, ipywidgets
Required-by:

Python version:

(adventofcode) C:gitleetcode>python --version
Python 3.10.0

vscode version:

1.63.2 (user setup)

vscode Jupyter extension version (from the changelog in the extensions window):

2021.11.100 (November Release on 8 December 2021)
Asked By: johanrex

||

Answers:

Notice that you put up a bug report in GitHub and see this issue: Renaming variables didn’t work, the programmer replied:

Some language features are currently not supported in notebooks, but
we are making plans now to hopefully bring more of those online soon.

So please wait for this feature.

Answered By: Molly Wang-MSFT

I am able to rename variables in one cell by:

  1. Select the variable
  2. Right click and choose "Change All Occurrences"
  3. Change the variable name
Answered By: Laylar Zhang

Ctrl + F2 ~ Change All Occurrences

Answered By: XitXat