completion/company: +auto by default

Questions regarding "completion not working" are very common, so the
+auto flag has been removed and idle completion enabled by default.
This commit is contained in:
Henrik Lissner 2019-05-03 21:53:36 -04:00
parent 3019b02d7d
commit 04acb8fa98
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 8 additions and 32 deletions

View file

@ -15,7 +15,7 @@
Modules that provide new interfaces or frameworks for completion, including code
completion.
+ [[file:completion/company/README.org][company]] =+auto +childframe +tng=: The ultimate code completion backend
+ [[file:completion/company/README.org][company]] =+childframe +tng=: The ultimate code completion backend
+ helm =+fuzzy +childframe=: *Another* search engine for love and life
+ ido: The /other/ *other* search engine for love and life
+ [[file:completion/ivy/README.org][ivy]] =+fuzzy +childframe=: /The/ search engine for love and life

View file

@ -12,10 +12,8 @@
- [[#code-completion][Code completion]]
- [[#vim-esque-omni-completion-prefix-c-x][Vim-esque omni-completion prefix (C-x)]]
- [[#configuration][Configuration]]
- [[#enable-as-you-typeidle-code-completion][Enable as-you-type/idle code completion]]
- [[#enable-company-backends-in-certain-modes][Enable company backend(s) in certain modes]]
- [[#troubleshooting][Troubleshooting]]
- [[#code-completion-doesnt-pop-up-automatically][Code-completion doesn't pop up automatically.]]
- [[#x-mode-doesnt-have-code-completion-support-or-requires-extra-setup][X-mode doesn't have code completion support or requires extra setup.]]
- [[#no-backends-or-the-incorrect-ones-have-been-registered-for-x-mode][No backends (or the incorrect ones) have been registered for X-mode.]]
@ -26,7 +24,6 @@ for code completion in many of Doom's :lang modules.
https://assets.doomemacs.org/completion/company/overlay.png
** Module Flags
+ =+auto= Enables as-you-type completion.
+ =+childframe= Enables displaying completion candidates in a child frame,
rather than an overlay or tooltip (among with other UI enhancements). *This
requires GUI Emacs 26.1+.*
@ -48,12 +45,11 @@ major mode's module's documentation for details.
* Features
** Code completion
Ccompletion must be triggered manually with the =C-SPC= key. If you want
as-you-type code completion, the ~+auto~ module flag will enable it.
By default, completion is triggered after a short idle period or with the
=C-SPC= key. While the popup is visible, the following keys are available:
| Keybind | Description |
|---------+------------------------------------------|
| =C-SPC= | Invoke code completion manually |
| =C-n= | Go to next candidate |
| =C-p= | Go to previous candidate |
| =C-j= | (evil) Go to next candidate |
@ -84,14 +80,6 @@ available to evil users to access specific company backends:
| =C-x s= | Complete spelling suggestions |
* Configuration
** Enable as-you-type/idle code completion
The =+auto= module flag enables this feature.
Otherwise, ~M-x +company/toggle-auto-completion~ will toggle this interactively.
Customize ~company-idle-delay~ to control how quickly the popup should appear.
The default is ~0.2s~.
** Enable company backend(s) in certain modes
The ~set-company-backend!~ function exists for setting ~company-backends~
buffer-locally in MODES, which is either a major-mode symbol, a minor-mode
@ -122,15 +110,6 @@ To unset the backends for a particular mode, pass ~nil~ to it:
If code completion isn't working for you, consider the following common causes
before you file a bug report:
** Code-completion doesn't pop up automatically.
This is by design. The expectation is that you invoke completion manually with
=C-SPC=. This was decided because code-completion backends can be slow, some
dreadfully so, and invoking them every time you move your cursor can add pauses
and delays while editing.
If, despite that, you still want this functionality, use the =+auto= flag to
enable it.
** X-mode doesn't have code completion support or requires extra setup.
There is no guarantee your language mode will have completion support.

View file

@ -2,8 +2,9 @@
(def-package! company
:commands (company-complete-common company-manual-begin company-grab-line)
:after-call (evil-insert-state-entry-hook evil-emacs-state-entry-hook)
:init
(setq company-idle-delay nil
(setq company-minimum-prefix-length 2
company-tooltip-limit 14
company-dabbrev-downcase nil
company-dabbrev-ignore-case nil
@ -16,6 +17,9 @@
company-frontends
'(company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
;; Lazy load until user starts entering text
(unless (featurep! :editor evil)
(add-transient-hook! 'post-self-insert-hook (require 'company)))
:config
(add-hook 'company-mode-hook #'+company|init-backends)
(when (featurep! :editor evil)
@ -23,13 +27,6 @@
(global-company-mode +1))
(def-package! company
:when (featurep! +auto)
:defer 2
:after-call post-self-insert-hook
:config (setq company-idle-delay 0.1))
(def-package! company-tng
:when (featurep! +tng)
:defer 2