0

For Python coding I use Elpy package which uses Company as completion framework.

Since I don't like automatic pop-ups I set my completion function to execute only when I explicitly ask for the completion suggestions with C-n keybinding. Unfortunately the setting for disabling a pop-up completion window is not working after pressing class member access operators such as ., ->, ::.

After looking through company-mode settings I found that company-semantic and company-clang have a toggle for switching on and off the automatic completion window. I set those to nil, but unfortunately there is no change in the behaviour. I used both 'customize' panel and manual assignment in the config.

Here is my config:

(use-package company
  :ensure t
  :hook (prog-mode . company-mode)
  :config
  (setq company-idle-delay nil  ;; works as expected, completion is not invoked
        company-semantic-begin-after-member-access nil  ;; still pops-up, no change :(
        company-clang-begin-after-member-access nil     ;; no change either :(
        company-minimum-prefix-length 3
        company-selection-wrap-length 1
        company-selection-wrap-around t)
  (evil-collection-define-key 'insert 'company-mode-map
    (kbd "C-n") 'company-complete)) ;; invokes completion manually 

And example picture showing spot where this issue occurs: enter image description here

Drew
  • 29,895
  • 7
  • 74
  • 104
Adaskos07
  • 41
  • 4
  • 1
    First, confirm which backend is in action by `M-x company-diag`. It looks like it should be `elpy-company-backend` in your case, then [this line](https://github.com/jorgenschaefer/elpy/blob/325f6ed000a115daf419e8d614fdce22aa95a78e/elpy.el#L3014) is expected to be responsible. – Y. E. Oct 05 '21 at 10:39
  • A `company-diag` commands says that current backend is `company-dabbrev` and mode is `python-mode`. I will play with dabbrev settings to see if anything changes. – Adaskos07 Oct 05 '21 at 16:07
  • And the `prefix` is `""` in the output of `M-x company-diag`? – Y. E. Oct 06 '21 at 12:06
  • `Prefix`: `nil`, `Completions`: `none` are values of other fields. Company version is 0.9.13 – Adaskos07 Oct 06 '21 at 12:47
  • Completions none? And you still see them shown by the frontend? See also : https://github.com/company-mode/company-mode/issues/1066#issuecomment-782294563 and [optional approach](https://github.com/company-mode/company-mode/discussions/1214) for force pop-up. – Y. E. Oct 06 '21 at 12:52
  • 1
    `company-dabbrev` does not include annotations like `function` and `statement`, so you were probably invoking `company-diag` at a wrong position. If you're using Elpy, it's Elpy's backend in play, and you should ask the author about the way to disable this behavior. – Dmitry Oct 06 '21 at 23:07
  • 1
    But even with that code in the backend, `company-idle-delay` set to `nil` should disable automatic popup triggering. @Adaskos07, can you verify that it's indeed `nil` during your coding session? – Dmitry Oct 06 '21 at 23:13
  • I opened `company-diag` in python buffer but it seems to me it returns wrong data. I switched temporarily to `lsp-mode` with `lsp-pyright` and the problem with class members disappeared. `company-diag` still returns exactly the same parameters in the message. Either back-ends changed and are not displayed in the company-diag message or the issue was inside `elpy` package itself. – Adaskos07 Oct 07 '21 at 09:04

0 Answers0