2 ms·
For example, in C++ in Visual Studio I can click on a class member variable or method and rename it and the IDE will rename all uses of that variable or method
by criddell 5y ago
For example, in C++ in Visual Studio I can click on a class member variable or method and rename it and the IDE will rename all uses of that variable or method and not get confused about other classes with the same name.
struct Foo
{
std::string name;
int age;
};
struct Bar
{
std::string name;
double weight;
};
Foo f1 = ...;
Foo f2 = ...;
Bar b = ...;
std::cout << f1.name;
In the code above I can select "name" on the last line and rename it. The Foo struct and all instances of name via f1 or f2 are updated to use the new name. Bar and instance b are untouched. AFAIK, Emacs can't do this.
- the-smug-one 5y agoYou use clangd and get it (as part of lsp-mode).
- yaantc 5y agoSuch renaming is part of the LSP protocol, so any LSP supporting editor (Emacs, nvim, etc.) will support this as long as the used language server does. I can do this with clangd and Emacs, but it's not Emacs specific anymore. There may still be some gap with some very advanced integrated IDE support, but the LSP ecosystem is still evolving and getting there. Which is not a surprise as Microsoft designed it for VS Code. The difference now is not so much between an IDE and a given editor, but between and IDE built-in language support and LSP servers for a given language. For C/C++ the progress of clangd is real over a few years, and it's very usable now.