Visual Studio 代码重构似乎不起作用(例如重命名符号 - f2) [英] Visual studio code refactoring does not seem to work (e.g. rename symbol - f2)
问题描述
所以我刚刚在 ubuntu 上安装了 1.27.2 版本的 vscode.我也安装了 c++ 的扩展.
So I have just installed vscode on ubuntu at version: 1.27.2. I have installed the extension for c++ as well.
一切都很好,只是我似乎无法使用重构操作.具体来说,我想使用重命名符号 (f2).
Its all working nicely, except that I cant seem to use the refactor actions. Specifically I want to use the rename symbol (f2).
当我单击一个变量并按 f2 时,什么也没有发生.如果我执行 ctrl+shift+r(重构操作),我总是得到没有可用的重构".
When I click a variable and press f2 nothing happens. If I do ctrl+shift+r (refactor actions) I always get "no refactorings available".
我检查了键绑定,它显示为f2":
I checked the key-bindings and it shows for "f2":
- 命令:重命名符号
- 按键绑定: F2
- 来源:默认
- 时间: editorHasRenameProvider &&editorTextFocus &&!editorReadonly
- Command: Rename Symbol
- Keybinding: F2
- Source: Default
- When: editorHasRenameProvider && editorTextFocus && !editorReadonly
所以我检查了编辑器是可写的并且文本具有焦点 - 两者都是正确的.但我不确定这个编辑器的重命名提供程序是什么?
So I checked that the editor is writeable and text has focus - both true. But I am not sure what this editor has rename provider is?
所以我需要安装其他东西?- 我怎样才能让重构工作?
So I need to install something else? - how can I get refactoring working?
更新
这现已在 vscode-cpptools
扩展中实现:版本 v0.26 称为重命名符号".
This has now been implemented in vscode-cpptools
extension: version v0.26 called "rename symbol".
推荐答案
C++ 扩展当前未实现重命名,但下周将为我们的内部人员"发布该功能的预览(设置 C_Cpp.updateChannel
设置为 "Insiders"
以获取它.
Renaming is not currently implemented by the C++ extension, but a preview of the feature will be released next week for our "insiders" (set the C_Cpp.updateChannel
setting to "Insiders"
to get it).
这篇关于Visual Studio 代码重构似乎不起作用(例如重命名符号 - f2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!