spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

Strange behavior for completions #16410

Open alandema opened 3 years ago

alandema commented 3 years ago

Problem Description

Following the #16342 , now I can set my keyboard delay time to 0ms and feel a completion experience more close to VSCode/PyCharm. But, when using the completion feature to import modules, it does not complete the line, instead it eat some letters and insert the whole completion hint. Also sometimes, the completion list appear where should appear the method detail, or appear in the end of the line, making it impossible to ENTER without having to ESC or use move the cursor with the mouse.

What steps reproduce the problem?

  1. Try to import numpy or pandas
  2. Try to create a numpy array

Trying to import modules spyder

The completion showing in wrong place (in the middle of parenthesis) spyder2

What is the expected output? What do you see instead?

The expected is the completion to complete the line and not try to override it. Also when already in the method, show the details.

Again, the example with VSCode. vscode

Also a possible improvement

It would be great if the completions are only used with TAB and not with ENTER. Sometimes, the user just want to go to next line without completing the current line. This is particular useful when your final argument is some variable named "aaaa" and you also have a variable named "aaaabbbb".

Versions

Dependencies

Mandatory:

atomicwrites >=1.2.0 : 1.4.0 (OK) chardet >=2.0.0 : 4.0.0 (OK) cloudpickle >=0.5.0 : 1.6.0 (OK) cookiecutter >=1.6.0 : 1.7.3 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.1.0 (OK) IPython >=7.6.0 : 7.27.0 (OK) jedi >=0.17.2;<0.19.0 : 0.18.0 (OK) jsonschema >=3.2.0 : 3.2.0 (OK) keyring >=17.0.0 : 23.1.0 (OK) nbconvert >=4.0 : 6.1.0 (OK) numpydoc >=0.6.0 : 1.1.0 (OK) paramiko >=2.4.0 : 2.7.2 (OK) parso >=0.7.0;<0.9.0 : 0.8.2 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.8.0 (OK) pygments >=2.0 : 2.10.0 (OK) pylint >=2.5.0;<2.10.0 : 2.9.6 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.2.2;<1.3.0 : 1.2.2 (OK) pylsp_black >=1.0.0 : None (OK) qdarkstyle =3.0.2 : 3.0.2 (OK) qstylizer >=0.1.10 : 0.2.1 (OK) qtawesome >=1.0.2 : 1.0.3 (OK) qtconsole >=5.1.0 : 5.1.1 (OK) qtpy >=1.5.0 : 1.10.0 (OK) rtree >=0.9.7 : 0.9.7 (OK) setuptools >=49.6.0 : 52.0.0.post20210125 (OK) sphinx >=0.6.6 : 4.1.2 (OK) spyder_kernels >=2.1.1;<2.2.0 : 2.1.1 (OK) textdistance >=4.2.0 : 4.2.1 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 2.1.5 (OK) zmq >=17 : 22.2.1 (OK)

Optional:

cython >=0.21 : None (OK) matplotlib >=2.0.0 : 3.4.3 (OK) numpy >=1.7 : 1.21.2 (OK) pandas >=1.1.1 : 1.3.2 (OK) scipy >=0.17.0 : 1.7.1 (OK) sympy >=0.7.3 : None (OK)

steff456 commented 3 years ago

Hi @alandema,

We will dig into this issue, I wasn't able to fully reproduce the first one. The second gif that you uploaded showed that the completions are showing after a , which is the expected behavior.

We will discuss with the team to see how we can improve the UX of the completions by seeing what to do with the Enter and Tab instructions.

Thanks for reporting!

alandema commented 3 years ago

Hello, @steff456. The first problem might be linked with Kite. Since 5.1.x my Kite is not working properly with Spyder, even after clean installations. It shows "initializing" for a looong time before it gets "indexing" for another long time to then gets ready. Also, Kite does not recognize the Spyder installation anymore. It used to be much faster in 4.x.x.

Sem título

The completion after "," is really showing the expected behavior, what I did not expect is to see completion after the numbers, trying to complete a "2" with "array", for example. This seems odd to me.

steff456 commented 3 years ago

Kite is no longer available for download because they sold the company. We are not sure how they will manage the maintenance of the package, but its integration with Spyder will not be continued to be maintained on our side. I only can recommend you to uninstall and use our PyLS backend.

LucaAmerio commented 2 years ago

I have the same issue of @alandema .

My examples are a bit different, but the issue is the same. I didn't prepare a gif, but you can check the behaviour below: import matplotlib.pyplot as plt (typed entirely)+[Enter] becomes import matplotlib.pyplot pyplot as plt, which makes no sense. pass+[Enter] becomes ppass, again, nonsense.

image

While working I've experienced this many many times, with variable names, function names, keywords, everything. I can try to expland this list if you think that this can be somehow useful.

The take away though is that Kite/Auto-completition doesn't work.

LucaAmerio commented 2 years ago

Disabling Kite "solves" the issue