F2 重命名变量在 vscode + jupyter notebook + python 中不起作用

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

我可以在 vscode 中的常规 python 文件中使用正常的 F2 重命名变量功能。但在 jupyter notebook 中编辑 python 时不会。

当我在 vscode 中的 jupyter notebook 中的变量上按 F2 时,我得到了熟悉的更改变量 window 但是当我按 enter 时,变量没有更改,我收到此错误消息:

No result. No result.

有没有办法让 F2 更改变量功能在 jupyter 笔记本中工作?

这是我的系统信息:

jupyter 模块版本

(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版本:

(adventofcode) C:\git\leetcode>python --version
Python 3.10.0

vscode版本:

1.63.2 (user setup)

vscode Jupyter 扩展版本(来自扩展 window 中的变更日志):

2021.11.100 (November Release on 8 December 2021)

请注意,您在 GitHub 中提交了错误报告并看到了这个问题:Renaming variables didn't work,程序员回复:

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

所以请等待这个功能。

我可以通过以下方式重命名一个单元格中的变量:

  1. Select变量
  2. 右键单击并选择“更改所有事件”
  3. 更改变量名