spyder-ide / spyder

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

Using TAB when entering a Path in a string in the Console doesn't go to line, but exceed spyder window to the second monitor. #15861

Open mscheltienne opened 3 years ago

mscheltienne commented 3 years ago

Problem Description

This one is a bit difficult to describe, so I will be using screenshots. The screenshots are taken in the same location, 75% on my left monitor where the Spyder window is opened and maximized, and 25% on my right monitor, where you can see my beautiful default macOS background.

Screenshot 2021-06-14 at 10 48 42

On this first screenshot, you can see that I started typing a Path in a string to load a file. If I press tab, the path completes itself.

Screenshot 2021-06-14 at 10 48 48

Now let's keep going until it does not fit in the spyder console.

Screenshot 2021-06-14 at 10 48 56

And that happened.. with the drop-down list to select the next folder being unusable and not even on the same screen as Spyder.

Versions

Dependencies

# Mandatory:
applaunchservices >=0.1.7     :  0.2.1 (OK)
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.24.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso =0.7.0                  :  0.7.0 (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.9.0 (OK)
pylint >=1.0                  :  2.8.2 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2;<0.4.0    :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.0 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.1.0             :  5.1.0 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=39.0.0           :  57.0.0 (OK)
sphinx >=0.6.6                :  4.0.2 (OK)
spyder_kernels >=2.0.4;<2.1.0 :  2.0.4 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  1.0.2 (OK)
zmq >=17                      :  22.1.0 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=2.0.0            :  3.4.2 (OK)
numpy >=1.7                   :  1.20.3 (OK)
pandas >=1.1.1                :  1.2.4 (OK)
scipy >=0.17.0                :  1.6.3 (OK)
sympy >=0.7.3                 :  1.8 (OK)
steff456 commented 3 years ago

Hi @mscheltienne,

I could create a new issue with the completions tooltip where the size is too small so the user can't read anything,

image

But I'm not able to have your same behavior. We will look what is happening with this because there are some cases were it is not doing what is expected. Can you look if this is true for all the completion tooltips or is something it is just happening in the console?

Thanks for reporting!

mscheltienne commented 3 years ago

@steff456 Which other completion tooltips do you have in mind? Could you give me a few examples so I can try to break them?

steff456 commented 3 years ago

Mainly, the editor ones

mscheltienne commented 3 years ago

@steff456 I also got a crash very easily when trying to enter a Path in a string in the editor using the completion tooltips and tabs.

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spyder/plugins/editor/extensions/snippets.py", line 817, in insert_snippet
    ast = build_snippet_ast(text)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/spyder/utils/snippets/ast.py", line 151, in build_snippet_ast
    raise SyntaxError('Syntax Error: Expected any of the following'
SyntaxError: Syntax Error: Expected any of the following characters: ['dollar', 'name', 'int', 'case', '\\:', '\\$', 'text_pipe', '{', '\\}', '\\', '\\/', '\\,', 'symbol', 'whitespace', 'left_curly_name', ':', ':+', ':-', ':?', ',', '}', '<eof>'], got <slash, />

I could reproduce the error multiple times. I opened a new file, and started typing:

"/Us -> Press Tab to complete to "/Users "/Users/sc -> Press Tab to complete to "/Users/scheltie "/Users/scheltie/ -> Press Tab to complete to "/Users/scheltie/Desktop

After further trials, the error occurs when using the completion tooltip marked with a star, be it an existing or non existing path.

Screenshot 2021-06-15 at 12 04 49