spacemacs auto-complete 设置后不能补全

大家好,最近刚入坑spacemacs,也正在学习相关的资料 我的设置 spacemacs auto-complete 后,不能按预期补全文件中的出现的单词,只能补全类名,函数名,我的预期是可以补全该文件中所有的单词 文件类型 .sv verilog-mode emacs版本 26.1

> dotspacemacs-configuration-layers
>    '(;; python
>      csv
>      ;; html
>      ;; ----------------------------------------------------------------
>      ;; Example of useful layers you may want to use right away.
>      ;; Uncomment some layer names and press `SPC f e R' (Vim style) or
>      ;; `M-m f e R' (Emacs style) to install them.
>      ;; ----------------------------------------------------------------
>      (auto-completion :variables
>                         auto-completion-front-end 'auto-complete
>                         auto-completion-return-key-behavior 'complete
>                         auto-completion-tab-key-behavior 'cycle
>                         ;;auto-completion-complete-with-key-sequence t
>                         auto-completion-complete-with-key-sequence-delay 0.1
>                         auto-completion-enable-sort-by-usage t
>                         auto-completion-enable-snippets-in-popup t
>                       :disabled-for markdown)
>      better-defaults
>      emacs-lisp
>      ;; git
>      helm
>      ;; lsp
>      ;; markdown
>      multiple-cursors
>      org
>      ;; (shell :variables
>      ;;        shell-default-height 30
>      ;;        shell-default-position 'bottom)
>      ;; spell-checking
>      ;; syntax-checking
>      ;; version-control
>      treemacs
>      chinese
>      ;; imenu-list
>      shell-scripts
>      yaml
>      ;; sp-tabnine
>      )

(defun dotspacemacs/user-config ()中设置了 (global-company-mode)

以上,麻烦路过的看下看块的配置有问题?

auto-complete 和 company 二选一,最好不要一起用。推荐用 company,用 company 的话好像要加一个什么 backend,我这边也没配过。

1 个赞

感觉您的回复,貌似不能解决我的问题

我不确认你理解了他的说法没有,建议去掉:

auto-completion-front-end 'auto-complete

这样 global-company-mode 默认也是激活的。

还有几点注意:确认是 develop 分支,说明在何种类型文件中测试的补全,在那个文件中 SPC-h-d-v company-backends 把结果贴上来。

另外以后贴代码应该放到 `` 中(行内),或者三个 ``` 中(没有反斜杠)

\```
code
\```
1 个赞

感谢回复,代码格式已经修改, auto-completion-front-end 'auto-complete 已经注释了,问题依旧, 确认是 develop 分支 :不太确定,或者说不知道如何确认分支 对比了下 .sv 和.org类型 .sv的不符合预期,.org的符合,SPC-h-d-v company-backends 的结果分别为: .sv

(company-bbdb company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
              (company-dabbrev-code company-gtags company-etags company-keywords)
              company-oddmuse company-dabbrev)

.org

Value:
((company-capf . #1=(:with company-yasnippet))
 (company-semantic company-dabbrev-code company-gtags company-etags company-keywords . 
#1#)
 (company-files . #1#)
 (company-dabbrev . #1#))
Original value was 
(company-bbdb company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
              (company-dabbrev-code company-gtags company-etags company-keywords)
              company-oddmuse company-dabbrev)
Local in buffer crm_task.org; global value is nil

请问是什么决定了这个补全的值呢?我应该如何修改?

ps:找不到帖子的编辑入口了,谁能告诉我在哪里重新编辑原帖?

安装时应该 git clone -b develop https://github.com/syl20bnr/spacemacs ~/.emacs.d, 或者 SPC h-I 看 System Info。

PS:company-dabbrev 和 company-dabbrev-code 是用来「补全文件中所有的单词」,sv 文件我不是很清楚。

经过各位的帮助,问题暂时解决,应该有更好的办法, 我的方式如下 手动设置了补全的backends

(defun dotspacemacs/emacs-custom-settings ()
  "Emacs custom settings.
This is an auto-generated function, do not modify its content directly, use
Emacs customize menu instead.
This function is called at the very end of Spacemacs initialization."
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(company-backends
   (quote
    (company-dabbrev company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
                     (company-dabbrev-code company-gtags company-etags company-keywords)
                     company-oddmuse company-bbdb)))