More better clangds

This commit is contained in:
John Doty 2023-05-26 13:59:40 -07:00
parent 7c093eb3da
commit 831f873dec

View file

@ -329,13 +329,11 @@
;; Common configuration for LSP-based systems. ;; Common configuration for LSP-based systems.
;; ================================================================= ;; =================================================================
(defvar my-clangd-executable (defvar my-clangd-executable
(executable-find "clangd") (or (executable-find "clangd-mp-14") ;; Support newer clangd
(executable-find "cppls-wrapper")
(executable-find "clangd"))
"Path to the clangd binary.") "Path to the clangd binary.")
(defvar my-cppls-fbcode-executable
(executable-find "cppls-wrapper")
"The path to the fbcode C++ language service wrapper.")
(defvar my-pylsp-executable (defvar my-pylsp-executable
(executable-find "pylsp") (executable-find "pylsp")
"The path to the python-lsp-server binary.") "The path to the python-lsp-server binary.")
@ -353,12 +351,11 @@
(flycheck-mode (if (eglot-managed-p) -1 nil))) (flycheck-mode (if (eglot-managed-p) -1 nil)))
(defun my-eglot-connect-hook (server) (defun my-eglot-connect-hook (server)
"Connect to SERVER. Don't send configuration information in C or C++." "Connect to SERVER. Don't send configuration information in C or C++."
(unless (or (eq major-mode 'c++-mode) (unless (or (eq major-mode 'c++-mode)
(eq major-mode 'c-mode)) (eq major-mode 'c-mode))
(eglot-signal-didChangeConfiguration server))) (eglot-signal-didChangeConfiguration server)))
(use-package eglot :ensure (use-package eglot :ensure
:commands (eglot-ensure eglot) :commands (eglot-ensure eglot)
:hook :hook
@ -371,11 +368,9 @@
:bind :bind
("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier. ("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier.
:config :config
(let ((cpp-executable (or my-cppls-fbcode-executable (when my-clangd-executable
my-clangd-executable))) (add-to-list 'eglot-server-programs
(when cpp-executable `((c++-mode c-mode) . (,my-clangd-executable))))
(add-to-list 'eglot-server-programs
`((c++-mode c-mode) . (,cpp-executable)))))
(let ((py-executable (or my-pyls-language-server-executable (let ((py-executable (or my-pyls-language-server-executable
my-pylsp-executable my-pylsp-executable