3 ms·
> Some IDEs that can semi-compile the code (to something like an AST) can provide a lot more support for refactoring correctly. Plenty of Emacs plugins invoke
by Mikeb85 5y ago
> Some IDEs that can semi-compile the code (to something like an AST) can provide a lot more support for refactoring correctly.
Plenty of Emacs plugins invoke a compiler, language server, whatever to get information about the code. That isn't a feature unique to IDEs.
- ReleaseCandidat 5y ago>Plenty of Emacs plugins invoke a compiler, language server, whatever to get information about the code. Yes, but Emacs (at least the LSP-modes of the languages I use) doesn't offer the same refactorings and code fixes like the same LSPs do with e.g. Code. Treesitter doesn't work with many languages, so syntax highlighting is also lacking for many languages.
- criddell 5y agoFor 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.