machine_setup/ansible/roles/emacs/files/lang-c.el
2022-10-20 00:03:56 -04:00

33 lines
725 B
EmacsLisp

(require 'common-lsp)
(require 'util-tree-sitter)
;; To generate a compilation database for the language server, run:
;; intercept-build13 --append make
;;
;; Output: compile_commands.json
(defun use-clangd ()
"Configure eglot to use clangd."
(eglot-ensure)
(defclass my/eglot-c (eglot-lsp-server) ()
:documentation
"Own eglot server class.")
(add-to-list 'eglot-server-programs
'(cc-mode . (my/eglot-c "clangd13")))
(tree-sitter-hl-mode)
)
(use-package cc-mode
;; c-mode c++-mode objc-mode java-mode idl-mode pike-mode awk-mode
:commands (c-mode c++-mode)
:pin manual
:hook (
(c-mode . use-clangd)
(c++-mode . use-clangd)
)
)
(provide 'lang-c)