重新安装了doom doom.d中init.el中, 打开了:completion company和:lang python
但是自动补全不能工作.
issue中8月10日, 11日有人遇到同样的问题.
重新安装了doom doom.d中init.el中, 打开了:completion company和:lang python
但是自动补全不能工作.
issue中8月10日, 11日有人遇到同样的问题.
我这边可以,但是有时候可能不会立即出结果。
我还在init.el
里开了:tools lsp
,还有各处抄来的配置,如下:
;; -------- company-tab9 --------
(def-package! company-tabnine
:init
(add-to-list 'company-backends #'company-tabnine)
;; Trigger completion immediately.
(setq company-idle-delay 0)
;; Number the candidates (use M-1, M-2 etc to select completions).
(setq company-show-numbers t)
;; Use the tab-and-go frontend.
;; Allows TAB to select and complete at the same time.
(company-tng-configure-default)
(setq company-frontends
'(company-tng-frontend
company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
;; The free version of TabNine is good enough,
;; and below code is recommended that TabNine not always
;; prompt me to purchase a paid version in a large project.
(defadvice company-echo-show (around disable-tabnine-upgrade-message activate)
(let ((company-message-func (ad-get-arg 0)))
(when (and company-message-func
(stringp (funcall company-message-func)))
(unless (string-match "The free version of TabNine only indexes up to" (funcall company-message-func))
ad-do-it))))
:bind
(:map company-active-map
("RET" . 'company-complete-selection)))
;; calling tab9 & lsp simultaneously
;; via: emacs-china.org/t/tabnine/9988/40
(defun Hesperus-company-sort-add-tabnine (candidates)
(if (or (functionp company-backend)
(not (and (listp company-backend) (memq 'company-tabnine company-backend))))
candidates
(let ((candidates-table (make-hash-table :test #'equal))
candidates-1
candidates-2)
(dolist (candidate candidates)
(if (eq (get-text-property 0 'company-backend candidate)
'company-tabnine)
(unless (gethash candidate candidates-table)
(push candidate candidates-2))
(push candidate candidates-1)
(puthash candidate t candidates-table)))
(setq candidates-1 (nreverse candidates-1))
(setq candidates-2 (nreverse candidates-2))
(nconc (seq-take candidates-1 2)
(seq-take candidates-2 2)
(seq-drop candidates-1 2)
(seq-drop candidates-2 2)))))
(add-to-list 'company-transformers 'Hesperus-company-sort-add-tabnine t)
;; `:separate` separately Sort different backgrounds
(add-to-list 'company-backends '(company-lsp :with company-tabnine :separate))
用lsp-python-ms
吧,python 补全体验跟 vscode 基本一样
按下M-x
后选择lsp
后可以进行提示了,但是原来的snippets却不显示了,比如ifmain
等,但是直接按下的话可以补全
在 .emacs.d/modules/tools/+lsp.el ,注释说为了确保company-capf 在company-backends第一个。