reddit / emacs

lsp-mode disconnected when opening a new buffer

malgician ยท 2022-07-27 01:56
Hello, I have lsp-mode set up to work with clangd. I have the following config: (use-package lsp-mode :commands (lsp lsp-deferred) :hook (lsp-mode . efs/lsp-mode-setup) :init ;; TODO: Properly use the general leader. (setq lsp-keymap-prefix "C-c l") :config (lsp-enable-which-key-integration t)) (setq lsp-clangd-binary-path "/usr/local/opt/llvm/bin/clangd") (add-hook 'c-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp) When I first open a cpp file, I start up in lsp-mode with the server connected. Then when I open another file in the same project, there is no lsp-mode. Running `M-x lsp` doesn't work, and running `M-x lsp-mode` causes lsp-mode to say it's disconnected. Moreover, running `M-x lsp-describe-session` shows the current file to be under the clangd instance in the tree alongside the other file that is indeed working. I was wondering if anyone has seen that before or has any tips on how to debug it. Thank you!