简体   繁体   中英

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: jupyter@googlegroups.org
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)

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

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.

Ctrl + F2 ~ Change All Occurrences

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM