reddit / emacs

lsp backed by ccls - no "expand macro" feature, broken "ref count" next to var/function name and "standard" types like double are not present when auto completing list is shown.

BaldSuperHare · 2022-02-09 04:31
Hi.I'm trying to recreate the overall emacs behavior I used to have before I've lost my .emacs file, and I would like to ask you for help. Edit: It is possible that I had some other packages installed than LSP related only, but I can't tell because I just copy pasted few configs together, without thinking too much about it and hoping that it would work. 1. I remember having this neat feature which (among others) would allow me to expand macro by clicking on some text stating "fix available" which would pop up in the buffer itself, and i can't get it to work. I do believe it had to do something with Flycheck package, but I might be wrong. 2. It's new feature, but very nice one: there is ref count displayed next to the function or variable declaration stating how many times this var/function has been referenced. However it does not seem to update "on the fly" and if I would delete said declaration the ref count stays where it was, or it concatenate itself with previous one (see pictures). There is another problem with this feature. These ref counters are supposed to be clickable, but when I do click them I'm getting an error :lsp-workspace-command-execute: ‘workspace/executeCommand’ with ‘ccls.xref’ failed.(wrong-type-argument json-value-p ccls\\.xref) 3. I have installed yasnippet, yet I don't have the auto completions (using company) for standard C types and keywords like double, float, for (worst of all, it gets auto completed to fork function), switch and others, and I remember that I have been able to get those auto completions before. 4. Edit: I've recently noticed that scrolling through file might cause loong freeze, while CPU usage skyrockets. I have not noticed it before, with my old config. [initial state](https://preview.redd.it/rnikqi0zgqg81.png?width=143&format=png&auto=webp&s=7175381acd634f268f7c6bb1645afbabb97f0cc6) [adding ref, yet no change in ref count](https://preview.redd.it/qp6kok0zgqg81.png?width=156&format=png&auto=webp&s=f33054cb5c0277be48980bc5333d89b933b6b232) [deleting all references](https://preview.redd.it/01hysj0zgqg81.png?width=173&format=png&auto=webp&s=3f3cff5b80327ac998ea9dd8c7631a1829637a20) I have no idea what's I'm doing wrong here. If it changes something I'm using helm and ergoemacs-mode (everything installed from vanilla emacs) atm. I'd really appreciate help. Here is part of my init.el with lsp config: (use-package lsp-mode :commands (lsp lsp-deferred) :init (setq lsp-keymap-prefix "<menu> l") :config (setq lsp-enable-which-key-integration t) (setq lsp-file-watch-threshold 2600) (setq gc-cons-threshold 10) (read-process-output-max (* 4 1024 1024)) ;; 4mb :hook ((c-mode c++-mode objc-mode cuda-mode python-mode) . (lambda () (lsp)))) (use-package lsp-ui :custom (lsp-ui-doc-position 'bottom) :commands lsp-ui-mode) (use-package lsp-treemacs :after lsp) (use-package company :after lsp-mode :hook (lsp-mode . company-mode) :bind (:map company-active-map ("M-i" . company-select-previous-or-abort) ("M-k" . company-select-next-or-abort) ("C-p" . nil) ("C-n" . nil)) :custom (company-minimum-prefix-length 1) (company-idle-delay 0.1)) (use-package flycheck) (use-package yasnippet) (use-package helm-lsp) (setq ccls-executable "ccls") (use-package ccls :hook ((c-mode c++-mode objc-mode cuda-mode) . (lambda () (require 'ccls) (lsp) (yas-minor-mode))))
BaldSuperHare · 2022-02-09 15:19
Ad 1) I have figured it out, just needed to add `(setq lsp-ui-sidline-show-hover t) (setq lsp-ui-sideline-show-code-actions t)` to the lsp-ui :config Still struggling with others tho.
brotzeitmacher · 2022-02-09 18:41
It's always a good thing to open a github issue, reddit posts will be forgotten after a few days. github issues are often used for discussions over months or even longer. And sometimes somebody adds docs based on those dicussions.
BaldSuperHare · 2022-02-10 23:43
will do.
sammymammy2 · 2022-02-11 12:35
>I have installed yasnippet, yet I don't have the auto completions (using company) for standard C types and keywords like double, float, for (worst of all, it gets auto completed to fork function), switch and others, and I remember that I have been able to get those auto completions before. yasnippet only gives you the ability to expand snippets. Snippets must be installed separately. This has nothing to do with autocompletion of functions, etc. Do you have a compiler_commands.json file in your project? At least clangd uses this to find all the type info.
[deleted] · 2022-02-15 06:57
[deleted]
Lu_ee · 2022-08-03 03:02
this PR works for me https://github.com/emacs-lsp/emacs-ccls/pull/104