doomemacs / doomemacs/core

Missing snippets when using completion through doom-package:corfu

Open
#8,183 8 comments 2 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [x] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [x] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [x] The issue can be reproduced on the **latest** available commit of Doom.

- [x] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

As I write the snippets are present along with other suggestions.

### Current behavior

While typing the snippets are missing from completion popup (or at least almost all).

### Steps to reproduce

I verified this for `rust`, `cpp` and `org` project/files, with and without my specific configuration (only with modified init/package).

Emacs is the version 29.4 from openSUSE repository.

From the tests I did, the only solution I found was to modify the `corfu` configuration in `doom`, changing the way in which `completion-at-point-functions` is updated changing the `depth` of `add-hook` function to 0.
This changed the order inside `completion-at-point-functions`:

before:
`(lsp-completion-at-point cape-file t cape-dabbrev yasnippet-capf)`

after:
`(lsp-completion-at-point yasnippet-capf cape-file cape-dabbrev t)`

This seems to fix the problem, at least in my system and in the rust, cpp and org cases.

I attach the modified part of code for reference:
```
diff --git a/modules/completion/corfu/config.el b/modules/completion/corfu/config.el
index fae0d36..d821c44 100644
--- a/modules/completion/corfu/config.el
+++ b/modules/completion/corfu/config.el
@@ -136,7 +136,7 @@ See `+corfu-want-minibuffer-completion'."
:init
(add-hook! 'prog-mode-hook
(defun +corfu-add-cape-file-h ()
- (add-hook 'completion-at-point-functions #'cape-file -10 t)))
+ (add-hook 'completion-at-point-functions #'cape-file 0 t)))
(add-hook! '(org-mode-hook markdown-mode-hook)
(defun +corfu-add-cape-elisp-block-h ()
(add-hook 'completion-at-point-functions #'cape-elisp-block 0 t)))
@@ -153,7 +153,7 @@ See `+corfu-want-minibuffer-completion'."
minibuffer-setup-hook
eshell-mode-hook)
(defun +corfu-add-cape-dabbrev-h ()
- (add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))
+ (add-hook 'completion-at-point-functions #'cape-dabbrev 0 t)))
(after! dabbrev
(setq dabbrev-friend-buffer-function #'+dabbrev-friend-buffer-p
dabbrev-ignored-buffer-regexps
@@ -182,7 +182,7 @@ See `+corfu-want-minibuffer-completion'."
:init
(add-hook! 'yas-minor-mode-hook
(defun +corfu-add-yasnippet-capf-h ()
- (add-hook 'completion-at-point-functions #'yasnippet-capf 30 t))))
+ (add-hook 'completion-at-point-functions #'yasnippet-capf 0 t))))

(use-package! corfu-terminal
:when (modulep! :os tty)

```

### System Information

https://pastebin.com/qzZAzXh5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.