Add Language Server

- Use ccls as language server for C/C++
This commit is contained in:
laurensmiers 2019-08-26 22:11:12 +02:00
parent e1abda326f
commit fad0df1881

View file

@ -15,14 +15,11 @@ My personal emacs configuration
This configuration requires the installation of :
- the GNU =global= package (for gtags)
- =clang= (for ivory)
- =cmake= (for ivory)
- =llvm-libs= (for cmake, somehow not a dependency on Manjaro when installing cmake)
- =ccls=, a language server for C/C++
- Use python-pip to install requirements for elpy:
=pip install jedi flake8 importmagic autopep8 yapf=
- =ditaa= (for ascii to image generation in org-mode)
When first checking out this config, run =irony-install-server= to make and install the irony-server.
* Workarounds
** Emacs 26.2
@ -846,29 +843,6 @@ https://github.com/joaotavora/yasnippet
)
#+END_SRC
** Flycheck
On-the-fly syntax checking.
#+BEGIN_SRC emacs-lisp
(use-package flycheck
:ensure t
:config
(add-hook 'prog-mode-hook 'flycheck-mode)
)
#+END_SRC
** Company mode
#+BEGIN_SRC emacs-lisp
(use-package company
:ensure t
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2))
(add-hook 'prog-mode-hook 'company-mode)
#+END_SRC
** (Relative) Line numbers
#+BEGIN_SRC emacs-lisp
@ -883,10 +857,9 @@ On-the-fly syntax checking.
*** Flycheck
Clang static analyzer with flycheck
Clang static analyzer with flycheck (On-the-fly syntax checking)
https://github.com/alexmurray/flycheck-clang-analyzer
https://github.com/Sarcasm/flycheck-irony
#+BEGIN_SRC emacs-lisp
(use-package flycheck-clang-analyzer
@ -895,44 +868,36 @@ https://github.com/Sarcasm/flycheck-irony
(with-eval-after-load 'flycheck
(require 'flycheck-clang-analyzer)
(flycheck-clang-analyzer-setup)))
(use-package flycheck-irony
:ensure t
:config
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
)
#+END_SRC
*** Company
https://github.com/ikirill/irony-eldoc
#+BEGIN_SRC emacs-lisp
(use-package company-c-headers
:ensure t)
(use-package company-irony
(use-package lsp-mode
:commands lsp
:ensure t
:config
(setq company-backends '((company-c-headers
;; company-dabbrev-code ;; not sure what this is
company-irony))))
(use-package irony
:ensure t
:config
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
)
(use-package irony-eldoc
(use-package lsp-ui
:commands lsp-ui-mode
:ensure t
)
(use-package company-lsp
:ensure t
:commands company-lsp
:config (push 'company-lsp company-backends)) ;; add company-lsp as a backend
(use-package ccls
:ensure t
:config
(add-hook 'irony-mode-hook 'irony-eldoc)
(setq ccls-executable "ccls")
(setq lsp-prefer-flymake nil) ;; Disable flymake for syntax checking, use flycheck instead
(setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc))
:hook ((c-mode c++-mode objc-mode) .
(lambda () (require 'ccls) (lsp)))
)
#+END_SRC
** Python mode