johanrex
johanrex

Reputation: 419

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

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:\git\leetcode>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:\users\johan\anaconda3\envs\adventofcode\lib\site-packages
Requires: ipykernel, qtconsole, nbconvert, jupyter-console, notebook, ipywidgets
Required-by:

Python version:

(adventofcode) C:\git\leetcode>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)

Upvotes: 10

Views: 5741

Answers (3)

XitXat
XitXat

Reputation: 57

Ctrl + F2 ~ Change All Occurrences

Upvotes: -1

Laylar Zhang
Laylar Zhang

Reputation: 123

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

Upvotes: 4

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9511

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.

Upvotes: 6

Related Questions