syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

Completion-at-point with helm in a python inferior REPL process causes flooding in REPL with autocompletion text #13688

Closed atreyasha closed 4 years ago

atreyasha commented 4 years ago

Description :octocat:

When executing completion-at-point using helm in a python inferior REPL, the shell (eg. ipython) gets flooded with autocompletion text when the user types or removes text from the helm window.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

System Info :computer:

Backtrace :paw_prints:

<<BACKTRACE IF RELEVANT>>

If it helps, I can also produce/upload a gif of the observed behaviour. Otherwise, below is a screenshot of what the autocompletion text flooding looks like:

2020-06-19-180111_1920x1180_scrot

cmatzenbach commented 4 years ago

This doesn't happen in SLIME (Common Lisp repl) either, so it does look specific to this layer. Unfortunately I don;t know python, I can take a look at the layer files but it would seem to be some setting/bug from the auto-completion, maybe helm. I think the quickest test you could run is to switch to ivy and see if it still happens - that should give us more info on where the bug is.

alexey0308 commented 4 years ago

As I understand, ipython completion is treated differently in python.el emacs file. I observe the issue only if one types quickly in the helm window, i.e. add a new symbol while the suggestion-list is being updated. It seems to be an issue with the python-mode. Does it help, if one removes "ipython" in python-shell-completion-native-disabled-interpreters by customize-variable, or if one uses python instead of ipython (SPC-u C-c C-p python)?

Alternatively, one may use helm-company instead of completion-at-point (bound to C-/ when company-mode is activated in the inferior-buffer and after company suggestion window has appeared).

atreyasha commented 4 years ago

Hi @cmatzenbach @alexey0308, thank you both for the quick responses. Regarding your suggestions:

  1. @cmatzenbach, I tried switching to ivy and this problem goes away. So this must have something to do with an interaction between python.el and helm.

  2. @alexey0308, removing ipython from python-shell-completion-native-disabled-interpreters or working directly in a python shell resulted in this issue going away. I am not entirely sure why this helps, any perspectives? Do you think removing ipython from the above-mentioned list could lead to problems downstream?

I disabled company-mode because it conflicts with some other private layers, so helm-company would probably not be a workaround for my use-case. But yes, helm-company could definitely be a workaround for users who use company-mode actively.

alexey0308 commented 4 years ago

I am not entirely sure why this helps, any perspectives?

I do not know, how all this functions, but the following change might be related to the reason, why ipython was added to the list. Although there was provided --simple-prompt flag for compatibility. But it is just a guess, and I can not say anything about downstream due to lack of knowledge. Hope it helps.

atreyasha commented 4 years ago

@alexey0308 no worries at all, thank you for sharing this information, it is very much appreciated :heart:

Just to conclude, I added the following under my dotspacemacs/user-config to resolve the issue (in case it is of help to other users who use ipython as their python inferior REPL):

(eval-after-load 'python
  '(setq python-shell-completion-native-disabled-interpreters
         (delete "ipython" python-shell-completion-native-disabled-interpreters)))

With that, will close this issue.