Visual Studio Code (Mac OS) 重命名符号不起作用 [英] Visual Studio Code (Mac OS) rename symbol doesn't work

查看:150
本文介绍了Visual Studio Code (Mac OS) 重命名符号不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我右键单击并尝试在 Mac OS Mojave 上的 Microsoft Visual Studio Code 中重命名变量名称时,它提示输入新名称,我按 Enter 键但没有任何反应.

When I right click and try to rename a variable name in Microsoft Visual Studio Code on Mac OS Mojave, it prompts for the new name, I hit enter and nothing happens.

我安装了 Python 扩展和 Latex 扩展.

I have Python extension and Latex extension installed.

通常没有错误,什么也没有.

Usually there are no errors, no nothing.

有时,会弹出一个小框,上面写着没有结果.没有结果".

Sometimes, there's a little box that pops up saying "No Result. No Result".

我选择的 python 解释器是 Conda 安装.

The python interpreter I selected was a Conda install.

我确保安装了绳索和 pylint.

I ensured rope, and pylint were installed.

预期行为:右键单击> 重命名符号> 输入新名称> 输入> 重命名的所有变量实例.

Expected behaviour: right click > rename symbol > type new name > enter > all instances of variable renamed.

观察到的行为右键单击> 重命名符号> 输入新名称> 输入> 变量在任何地方都具有相同的名称,包括重命名的位置.

Observed behaviour right click > rename symbol > type new name > enter > variable has same name everywhere, including spot of renaming.

推荐答案

事实证明,解决方案很简单,但令人沮丧.要在 VS Code 中进行重构(至少对于 python),您需要在工作区中.

It turns out the solution was simple, but frustrating. To do refactoring in VS Code (at least for python) you need to be in a workspace.

我通过首先关闭我所在的打开文件夹解决了这个问题:

I solved the problem by first closing the open folder I was in:

文件 > 关闭文件夹.

File > Close Folder.

然后导航到我正在编辑的 .py 文件的子文件夹,然后打开它.在我的情况下是

then navigating to a sub folder of .py file I was editing, and opening it. In my case it was

  1. 点击屏幕左上角的小文档图标
  2. 在欢迎屏幕中,选择打开文件夹"
  3. 导航到我的桌面文件夹(我的 .py 文件所在的位置)

现在重构按预期工作

点击屏幕左上角的文件图标>在欢迎屏幕中

Click on file icon in upper left of screen > in the welcome screen

这篇关于Visual Studio Code (Mac OS) 重命名符号不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆