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

Spyder "Autocompletion / Go to definition" fails on Windows when an import folder is named "array" #22091

Open wlter opened 5 months ago

wlter commented 5 months ago

Issue Report Checklist

Problem Description

What steps reproduce the problem?

  1. Install the current anaconda with spyder on Windows (Anaconda3-2024.02-1-Windows-x86_64)
  2. Create a repository which contains a folder named "array"
    • Create a folder to be integrated as repository, lets call it "testrepo". Add that folder in the pythonpath manager.
    • Create some subfolder e.g. "pathdebug" and add an empty init.py.
    • Create a subfolders in testrepo/pathdebug named "array".
    • Inside that, add an empty init.py and a simple python file that can be imported from, e.g. test.py with some definition of an empty function.
  3. Open an empty python file in spyder and start to type 'from pathdebug.array.test import...'

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

This happens and this is expected: After the first dot i.e. 'from pathdebug.' the autcompletion pops up an suggests 'array' as a followup package. Then this happens and this is not expected: after the second dot 'from pathdebug.array.' no autocompletion pops up and it cannot be forced to pop up even with Ctrl+Space. Also, right click on 'array' and "go to definition" will not open the init of the folder.

You may then continue to import the empty function from inside the array folder, but "Go to definition" will not work.

This seems to be directly related to the name "array". Renaming the folder to something else e.g. "notArray" solves the problem. Then autocompletion works and goto definition works again.

We have seen this issue on two windows machines, but could not see it on a linux setup (possibly a different version of spyder though).

Versions

ccordoba12 commented 5 months ago

Hey @wlter, thanks for reporting and the detailed description to reproduce the problem. We'll try to take a look at this after we release Spyder 6.0 next month.