Please add renaming
It would be very useful if this tool also supported renaming of variables.
@sean-mcmanus Correct me if I am wrong, but I believe the CppProperties.json file only works for "Open Folder" projects. Can CppProperties.json be used with solution file based projects as well?
I am using a solution and I have set the toolchain to "llvm" in the project properties so I expect that setting to be passed on to intellisense.
@rtosman Yeah, you're right, it's for Open Folder, not projects. If you're using the a project, the "mode" is supposed to be picked up by IntelliSense from the project.
@sean-mcmanus thanks for confirming. We are off track now though, as I really wasn't look for a fix to Visual Studio, as I use VS Code mostly :-)
FWIW. I did try setting the intellisense mode in c_cpp_properties.json under vscode to "msvc-x64", and I didn't get the errors that I get with Intellisense under Visual Studio 2017.
@sean-mcmanus @bobbrow Actually, after looking carefully at my vscode intellisense configuration, I realized I had a misconfiguration. I fixed the misconfiguration, and now I do get the erroneous error report from intellisense on vscode (the same as I get with intellisense on Visual Studio).
Here is my c_cpp_properties.json file: { "configurations": [ { "name": "Windows", "includePath": [ "${workspaceFolder}/**", "c:/SFML-2.5.0/include" ], "defines": [], "compilerPath": "c:/Program Files/bin/clang++", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "clang-x64" } ], "version": 4 }
So, it appears that intellisense is using the msvc front end and it ignores the "intelliSenseMode" setting (at least wrt to this specific behavior).
@rtosman As mentioned previously, the msvc front-end is implemented in cl.exe (c1xx.dll), and we don't use any of that code. Clang on Windows uses Microsoft extensions (msvc-x64 mode, not clang-x64) in order to compile the Windows headers and it is a different mode than the non-Windows clang (i.e. via /usr/bin/clang with WSL). What bug are you experiencing exactly? Can you file a new issue with the repro steps?
@sean-mcmanus Did you look at my compiler explorer link from my comment above. That details the error very concisely. The error log from my actual code base (the compiler explorer link is a reduced example) within vscode is:

Yes, now that I know it exists in vscode I will file a report.
Symbol based refactoring is highly desired for my workflow. The multi select ctrl+F2 renaming is insufficient as it applies the rename, often incorrectly, across the whole file. This would bring C++ up to speed with other VS code languages that support all the refactoring features listed here: https://code.visualstudio.com/docs/editor/refactoring
This issue was opened in 2016, and it is still not implemented. The devs of this tool very clearly do not develop any code in C/C++, as ~~they fail to realize that~~ this feature is absolutely crucial for that.
Until you've decided to implement this feature, I'm sadly forced to leave this editor for one that supports it. Hopefully not for too long.
I'm sorry for your frustration and we're sad to see you go, but resorting to insults will not increase the priority of this request. This is a free extension with a very small team of developers working on it so we have no choice but to prioritize feature requests based on the number of upvotes. This request is on our radar but is not currently the most upvoted feature. As of this writing it's number 4.
But maybe it's not upvoted, because only few people develop C/C++ in VSCode, because without this feature it's almost impossble to. For example in our company, 3 other less senior developers asked me what IDE I prefer for C/C++ and I told them that VSCode, but that I can't recommend it to them, because of this feature missing. And it was the same story in my previous companies. So I guess the demand is huge. Btw I checked the n1 upvoted feature and it's closely coupled with this one. It's so coupled it's almost interchangeble.
We have telemetry on the number of people writing C++ in VS Code and it is actually not a small number.
And yes, you are correct. The number 1 feature is very closely related to this one (it's basically a dependency).
@Nearoo We implement our extension processes in C++. I normally use VS Code but I switch to Visual Studio when I need some advanced feature like renaming, memory breakpoints, etc. VS Code's find/replace ability can also be used to assist with renaming.
We've done some preliminary work on the number 1 upvoted issue (Find All References) in regards to improving Go to Definition -- we're still working on getting IntelliSense-based definitions/references to work across translation units, which is a pre-requisite for renaming (https://github.com/Microsoft/vscode-cpptools/issues/2536). The code that gets the correct symbols is shared between all the features mentioned.
I would just like to add my support to bobbrow's comment. In windows there are plenty of nice IDE's, but in the linux world there are only a few and most have "issues". I have tested many IDEs for c++ (qt creator, codelite, netbeans, codeblocks, eclipse, etc...) and I have shortllisted vscode and codelite, I think vscode would be our (team of 10-15 people) tool of preference if it had refactoring, but without it its number 2 choice.
@code-fodder @salda I develop c++ using only vscode mainly because I switch so much between operating systems. Used to use emacs but prefer vscode because configuring for c++ is so much less labor intensive, and vscode is more mainstream for extensions.
Until multi-translation unit is ready, I have been using cquery extension for c++ auto-complete/refactoring and disable the language server in settings for cpptools (this was a recently added feature that came from a request in a different related thread). This allows you to still use the debugger portion of cpptools.
I will switch back to cpptools for everything once they have this developed - but this allows me to use vscode for c++ dev in the meantime.
@dprandle I did not see much documentation for cquery for c++11... do you know if it supports that?, not that it matters too much just for refactoring, but if it replaces the vscode intellisense then it needs to have decent support for new language features (hopefully). But thanks for the pointer I will try it anyway.
@code-fodder Yes it does - it supports anything that clang 6 supports as that is what it uses (at the time I built it) - it builds with its own version of clang and is straight forward to set up. It uses a compile_commands.json for configuration - so depending on your build system that could be a pain to set up. I use cmake so it works just fine. Though it uses it's own version of clang as its backend, you can use whatever compiler you want to compile the code I believe. I have used it with several versions of clang and gcc with succes - haven't tried it with msvc. I'm not sure it can convert the compiler arguements from msvc in the compile_commands or not.
Is there any timeframe for this and related features. I deeply appreciate the work of the VSCode team, but it has been two years and VSCode is still not useable for me (as I prefer to develop). Indeed the lack of C/C++ refactoring is the primary reason I do not have VSCode open at this very moment. I think what many of us would appreciate would be some indication of a timeline.
@jockm Rename's implementation is based on Find All References, which we're currently working on. Find All References may get pushed back to January, so my best guess for Rename is February. But we haven't decided how to handle UI and API limitations with VS Code yet (i.e. no streaming references, no rename confirmation/config dialog, etc. compared to what VS supports).
@sean-mcmanus I won't lie, this is disappointing to hear; but at least it gives me an idea. Thank you!
@sean-mcmanus January/February does not sound so bad for me. If confirmation dialogs bother you, why not having a editable JSON file instead? Like for the keyboard mapping or the settings. Or just no dialogs, the user can see all the changes in the source control view anyway. Or open all modified files, and make the respective changes as undoable modifications without saving, which is the default for TypeScript. Then the user can undo/inspect changes without source control. Anyway, having a renaming feature for C++ would be extremely great.