Updated lsp mode (markdown)

Tianyi Li 2022-04-17 22:30:46 -07:00
parent 769ddee200
commit edfdbc7c39

@ -1,4 +1,4 @@
1. Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) and optionally, [lsp-ui](https://github.com/emacs-lsp/lsp-ui) + [company-lsp](https://github.com/tigersoldier/company-lsp) 1. Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) and optionally, [lsp-ui](https://github.com/emacs-lsp/lsp-ui) + ~~[company-lsp](https://github.com/tigersoldier/company-lsp)~~ (company-lsp was deprecated and no longer works with lsp-mode, reference https://github.com/scalameta/metals/issues/2641)
2. Install [emacs-ccls](https://github.com/MaskRay/emacs-ccls) (Melpa: https://melpa.org/#/ccls) and [configure](#configure) it 2. Install [emacs-ccls](https://github.com/MaskRay/emacs-ccls) (Melpa: https://melpa.org/#/ccls) and [configure](#configure) it
3. Open a source file where either [[.ccls|Project-Setup#ccls-file]] or [[compile_commands.json|Project-Setup#compile_commandsjson]] is in the project root (it works without them, if you don't need extra compiler command line options like `-I`) 3. Open a source file where either [[.ccls|Project-Setup#ccls-file]] or [[compile_commands.json|Project-Setup#compile_commandsjson]] is in the project root (it works without them, if you don't need extra compiler command line options like `-I`)
4. `(require 'ccls)`, `M-x lsp` 4. `(require 'ccls)`, `M-x lsp`
@ -18,7 +18,6 @@ set `c-c++-backend` to `lsp-ccls` in the `+lang/c-c++` layer
```elisp ```elisp
(use-package lsp-mode :commands lsp) (use-package lsp-mode :commands lsp)
(use-package lsp-ui :commands lsp-ui-mode) (use-package lsp-ui :commands lsp-ui-mode)
(use-package company-lsp :commands company-lsp)
(use-package ccls (use-package ccls
:hook ((c-mode c++-mode objc-mode cuda-mode) . :hook ((c-mode c++-mode objc-mode cuda-mode) .
@ -186,8 +185,9 @@ lsp-ui-doc.el renders comments in a child frame (Emacs >= 26) or inline (< 26).
``` ```
### Completion ### Completion
DO NOT install company-lsp. This package is deprecated and no longer works with lsp-mode, https://github.com/scalameta/metals/issues/2641
Add `company-lsp` to `company-backends`. ccls has a fuzzy matching algorithm to order candidates according to your query. You may want to disable client-side cache and sorting: ~~Add `company-lsp` to `company-backends`. ccls has a fuzzy matching algorithm to order candidates according to your query. You may want to disable client-side cache and sorting:~~
```elisp ```elisp
(setq company-transformers nil company-lsp-async t company-lsp-cache-candidates nil) (setq company-transformers nil company-lsp-async t company-lsp-cache-candidates nil)