最近看到了company新的替代方案corfu,试了一下,在Windows上和lsp搭配的表现确实不错,但是好像不支持lsp中的snippet,求教各位大佬有没有什么解决方案。
这是与lsp相关的所有配置:
(use-package lsp-mode
:straight t
:custom
(lsp-completion-provider :none)
:init
(defun my/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex))
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless)) (setq lsp-mode t))
(add-hook 'orderless-style-dispatchers #'my/orderless-dispatch-flex-first nil 'local)
(setq-local completion-at-point-functions (list (lsp-completion-at-point)))
:hook
((lsp-completion-mode . my/lsp-mode-setup-completion)
(python-mode . (lambda ()
(require 'lsp-pyright)
(lsp)))
这是与corfu有关的所有配置:
(use-package corfu
:straight t
:bind (:map corfu-map
("TAB" . 'corfu-insert)
("<backtab>" . 'corfu-complete)
("RET" . 'newline))
:custom
(corfu-auto t) ;; Enable auto completion
(corfu-quit-at-boundary t) ;; Automatically quit at word boundary
(corfu-quit-no-match t) ;; Automatically quit if there is no match
(corfu-preview-current nil) ;; Disable current candidate preview
:hook ((prog-mode . corfu-mode)
(shell-mode . corfu-mode)
(eshell-mode . (lambda ()
(setq-local corfu-quit-at-boundary t
corfu-quit-no-match t
corfu-auto nil)
(corfu-mode))))
:init
(corfu-global-mode))
在录制GIF时,yas-minor-mode已确认打开。