You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have something like this bound to RET on the company-active-map.
(defun j-company-expand-yasnippet-or-return ()
"Expand yas template or call RET normally.
If `yasnippet' expansion in progress, always complete selection."
(interactive)
(cond
;; `yasnippet' expansion in progress.
((yas-current-field)
(call-interactively #'company-complete-selection))
;; Check the type of the candidate.
((and company-active-map
company-selection-changed
(car company-candidates) ;; Making sure there are candidates.
(let ((candidate (nth company-selection
company-candidates)))
(or
;; This might work for `eglot'.
;; (get-text-property 0 :label candidate)
;; `company-lsp'
(get-text-property 0 'lsp-completion-item candidate)
;; `company-sourcekit'
(get-text-property 0 'sourcetext candidate)
;; `yasnippet'
(get-text-property 0 'yas-template candidate))))
(call-interactively #'company-complete-selection))
(:default
(when company-selection-changed
(company-complete-selection))
(let ((company-active-map))
(call-interactively (key-binding (kbd "RET")))))))
Without company-fuzzy, if I'm on a snippet expansion in the company-mode popup/auto complete menu, pressing RET calls company-complete-selection which then expands the snippet.
For example, in a C file.
if| popup shows with if yasnippet selection -> press ENTER
Result:
if (/cursor/) {
}
When I pair the same setup with company-fuzzy.
Result:
if/cursor/
If I then, press TAB after that, snippet expands normally.
The text was updated successfully, but these errors were encountered:
Hmmm... Interesting, without any configuration with company-fuzzy and company, does it exactly do what you want? Because it does exactly the same, you describe as default? :/
Just to clarify, you want to expand snippet when the menu is still popup?
I have something like this bound to RET on the company-active-map.
Without company-fuzzy, if I'm on a snippet expansion in the company-mode popup/auto complete menu, pressing RET calls company-complete-selection which then expands the snippet.
For example, in a C file.
if| popup shows with if yasnippet selection -> press ENTER
Result:
if (/cursor/) {
}
When I pair the same setup with company-fuzzy.
Result:
if/cursor/
If I then, press TAB after that, snippet expands normally.
The text was updated successfully, but these errors were encountered: