Hacker News new | ask | show | jobs
by cmrdporcupine 850 days ago
"savvy enough" for emacs these days for lsp is literally "M-x package-install lsp-mode"

Earlier today I started up emacs in a C++ project after working exclusively in Rust, and I didn't have an lsp server for C++ installed. I did M-x lsp-mode and it prompted me (paraphrased): No language server for C++ installed, do you want me to go get one for you? Options are: clangd. Sure, said I, and it just went and installed it and off I went.

Granted, you'll also need company-mode and stuff, yes. And to get an IDE like experience... treemacs, projectile, etc. etc.

Yes, it's an acquired taste. But it's not like it's obsolete. It's better and more active than it's ever been. And I've been using Emacs (mostly casually) since 1992.

2 comments

I was gonna mention that installing lsp-mode is as easy as clicking 'Options->Manage Emacs Packages', scrolling down to lsp-mode, clicking it, and clicking 'Install', however it turns out lsp-mode isn't in GNU or NonGNU Elpa, so it requires setting up MELPA first. So unfortunately it isn't entirely tech journalist friendly.
First you have to know that lsp-mode exists. VSCode just detects what to do from the file.

About projectile: Emacs ships with project.el and that does 90% of what projectile can do.

I'm sorry maybe this has improved in the two years since I tried but the last time I tried to set up VSCode to even approach the capabilities of CLion (the tool I used most at the time) it required a whole bunch of configuration, and stuff that felt more brittle and confusing than the emacs setup I have now.

In particular, no, it did not do all the LSP stuff out of the box, and didn't do basic refactorings out of the box either. Maybe it does so for other languages? Or maybe they've fixed the UX? But I recall having to install at least two or three plugins. And along the way found some that fought with each other.

I have never used VSCode for C/C++, only Emacs and Visual Studio, so I can't comment on how it compares to CLion. VSCode and C#, however, is something I prefer to Visual Studio or even Rider.