Please add renaming
It would be very useful if this tool also supported renaming of variables.
I sure wish we had this rename feature in VSCode, because when I try to do it in VS 2017, it sometimes freezes and I have to End Task. I was sure that VSCode would have it. Very disappointed.
As mentioned above, it is now in the July milestone (along with "find all references" - they are linked) - see https://github.com/microsoft/vscode-cpptools/milestone/39. So fingers crossed! And best of luck to the VSCode devs involved.
@Jimbo99 the July release is actually going to slip into August because we got a little behind on our June release, but yes, renaming is coming soon. We are working to have an insiders build with Find all References in July, with rename support shortly after.
@bobbrow Thank you for the update and clarification. I get the impression this kind of stuff goes right through the lower levels of how the editor works, so just very glad you are working on it and we can see the light at the end of the tunnel now! :) Keep up the great work.
@Jimbo99 Well yes and no. Remember that other languages already support Find All References, Rename, and other far more advanced refactors already... for years now. The only area where it might be an editor issue is that is has been said that some UI changes might be needed (though not adequately explained IMHO). None of that prevented a partial implementation. This seems to be more an issue with priorities than anything else
Please correct me if I am wrong
@jockm Yeah, the C++ case is more difficult than other languages, but we had other priorities up until the past month.
What is more important than C++ from the past 2 years xD...? Nothing is more important than C & C++ 😏😝
So, it could find the definition and all references but couldn't rename them? Or there are some ways I don't know? Could someone tell me? 😥
@XZJIsme Change All Occurrences (or Ctrl+F2) simply replace all the occurrences of your selection. In your case all the str literals appear in the file happen to reference to the variable str. However they're just occurrences of literal, not references to variable. Since you didn't really "find the definition and all references", you certainly cannot rename them.
@XZJIsme
Change All Occurrences(or Ctrl+F2) simply replace all the occurrences of your selection. In your case all thestrliterals appear in the file happen to reference to the variablestr. However they're just occurrences of literal, not references to variable. Since you didn't really "find the definition and all references", you certainly cannot rename them.
@EternalPhane 我主要是疑惑,为什么vscode可以找出references和definition,却不能有重命名的功能呢?python就可以。😂
@XZJIsme
Change All Occurrences(or Ctrl+F2) simply replace all the occurrences of your selection. In your case all thestrliterals appear in the file happen to reference to the variablestr. However they're just occurrences of literal, not references to variable. Since you didn't really "find the definition and all references", you certainly cannot rename them.@EternalPhane 我主要是疑惑,为什么vscode可以找出references和definition,却不能有重命名的功能呢?python就可以。😂
I can help explain it to you in Chinese. 上面的回答已经告诉你了,目前实现的功能是“找到所有出现的地方(occurrences)”,也就是简单的文本查找替换。并不能识别上下文语义、作用域等等。vscode只是一个文本编辑器,它只提供一个基础框架。精确找到变量定义和所有使用需要解析语言,一般通过插件实现。Python这部分已经实现了,官方的Python插件会附加安装Language Server负责解析语言。但这部分C++还没有实现。但据说快了,本来说七月份开发完。
@XZJIsme
Change All Occurrences(or Ctrl+F2) simply replace all the occurrences of your selection. In your case all thestrliterals appear in the file happen to reference to the variablestr. However they're just occurrences of literal, not references to variable. Since you didn't really "find the definition and all references", you certainly cannot rename them.@EternalPhane 我主要是疑惑,为什么vscode可以找出references和definition,却不能有重命名的功能呢?python就可以。😂
@XZJIsme sorry for misunderstanding you. (*/ω\*)
Currently cpptools still has some corner case bugs on Go to Definition (e.g. #3941). As @sean-mcmanus mentioned in this post, Find All References can't work correctly until Go to Definition is fully functional.
@EternalPhane The Go to Definition issues were fixed a few months ago. We're currently testing/fixing bugs with Find All References -- our goal is to release it in 0.25.0-insiders in a couple weeks. I'm not sure yet how much longer Rename will take (based on Find All References).
UPDATE: Still finding/fixing bugs with Find All Refs, but it's looking pretty good. Rename might take -2 weeks more?
@XZJIsme
Change All Occurrences(or Ctrl+F2) simply replace all the occurrences of your selection. In your case all thestrliterals appear in the file happen to reference to the variablestr. However they're just occurrences of literal, not references to variable. Since you didn't really "find the definition and all references", you certainly cannot rename them.@EternalPhane 我主要是疑惑,为什么vscode可以找出references和definition,却不能有重命名的功能呢?python就可以。😂
@XZJIsme sorry for misunderstanding you. (/ω\) Currently cpptools still has some corner case bugs on
Go to Definition(e.g. #3941). As @sean-mcmanus mentioned in this post,Find All Referencescan't work correctly untilGo to Definitionis fully functional.
@EternalPhane @Whotakesmyname understood now,thank you!是我浮浅了😂
Unbelievable that such a basic feature has STILL not been implemented after 3 years, especially from a company with the resources of microsoft. Absolutely rediculous.
Unbelievable that such a basic feature has STILL not been implemented after 3 years, especially from a company with the resources of microsoft. Absolutely rediculous.
I know right? I guess being a company with a $1T market capitalization doesn't get what it used to in the old days ;-)
@L0laapk3 @rtosman I'm sorry you are feeling frustrated about the delay for this. This free extension hasn't always been funded to the degree that you would normally expect from paid products. However, we are nearing the endgame for this feature. #15 is a dependency, and we are preparing to release that soon. This will be in the following release.
@bobbrow I know for myself I am not ungrateful, but deeply deeply frustrated
It would be a bit different if other languages hadn't had refactoring for years now, or if incremental support for C++ refactors have been released over that time, or if it had been a higher priority, or even if the communication process about this been better; then I for one would have been much less frustrated
I am grateful that VSCode is a free and open product, but please don't deminimize our legitimate frustration over this either
but please don't deminimize our legitimate frustration over this either
I apologize if that was what you read out of my comment. That was not my intent. I was trying to offer hope. Unfortunately, there is only a limited amount of detail I can share publicly about why we are where we are today.
@bobbrow If you just had utilized clangd, this could have been implemented much quicker.
please don't start this again… We all know that MS have their own 'licensed technology' (how long back does that go ? VC 4/5/6?) and we mere mortals are not supposed to elaborate on that again and again.


