reddit / emacs

need to restart lsp workspace for every new buffer

Quadratic_Resi_Do · 2022-08-04 16:25
I've been using lsp for a while on my laptop to edit c files (clangd). It works brilliantly. ​ I just started using it on another computer, and although it works fine for the first buffer I open in a project, every subsequent buffer that I open highlights an error that one of the included libraries is "not found." I use CMake, so I've pointed to the build/compile\_commands.json, which seems to be picked up when I open the first buffer, but for some reason, every other buffer after the first does not see it \_unless\_ I restart the workspace. ​ Summary: I need to restart my lsp workspace in every buffer after the first in a project for it to pick up the correct compile\_commands.json, but it seems to work on another computer. I'm not sure what I can do to debug this, since the logs printed to clangd::stderr and lsp-log don't show anything abnormal. Anyone have any pointers on where I can look next?
sadomaru · 2022-08-04 17:03
It's emacs. Have you tried turning it off and on again?
Quadratic_Resi_Do · 2022-08-04 17:04
lol, as in the emacs program itself? \^\_\^ yes, I've tried shutting down and restarting emacs and blowing away / reinstalling my .emacs.d
PhantomSeahorse · 2022-08-04 18:14
I haven’t experienced this issue. Probably something in your config? It could be some hooks are set up wrong
bagtowneast · 2022-08-05 02:37
Did you change operating systems?
peterhoeg · 2022-08-05 14:26
I suggest you check what projectile thinks is the root of the project and what lsp thinks. In case lsp gets it wrong (which it does sometimes), you can blow away the lsp session cache and try again.
J-ky · 2022-08-05 22:59
For any problems in lsp-mode, try eglot. I also had issues of restarting lsp server a bout a year ago with lsp-mode. I thought it had been fixed.