elken / yasnippet-capf

Completion-At-Point Extension for YASnippet
GNU General Public License v3.0
40 stars 9 forks source link

fix: clear overlays when erasing the doc buffer #19

Closed LemonBreezes closed 6 months ago

LemonBreezes commented 6 months ago

Previously, the doc buffer would not clear the overlays when it was switching between different snippets. This would cause yas--advance-end-maybe-previous-fields to fail its cl-assert and consequently no popup would show.

Maybe with this we can also re-add my previous PR!

yorisilo commented 6 months ago

@LemonBreezes Thank you so much! I didn't know how I should fix it.

I was struggling with the following error. (Moreover, no error occurs when I set debug-on-error to t...)

Error running timer 'corfu-popupinfo--show': (cl-assertion-failed (memq field (yas--snippet-fields snippet)))
LemonBreezes commented 6 months ago

@LemonBreezes Thank you so much! I didn't know how I should fix it.

I was struggling with the following error. (Moreover, no error occurs when I set debug-on-error to t...)

Error running timer 'corfu-popupinfo--show': (cl-assertion-failed (memq field (yas--snippet-fields snippet)))

No problem. I honestly looked at the code for yasnippet-capf--doc-buffer and yas--advance-end-maybe-previous-fields and immediately knew the issue was caused by the overlays not being cleared, based on my past experience of working with overlays. You'd be surprised how useful adding (global-set-key (kbd "C-x x o") #'ov-clear) to your config is by the way.