You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AutoImport's get_modules is case insensitive. Not sure if exactly a bug, but I don't think this behavior fits considering the method is used for full names and not for autocompletion purposes.
To Reproduce
from pathlib import Path
from rope.base.project import Project
from rope.contrib.autoimport.sqlite import AutoImport
autoimport = AutoImport(Project(Path()), memory=False)
autoimport.generate_cache()
autoimport.generate_modules_cache()
print(autoimport.get_modules("C"))
The code above prints ['calendar'] but from calendar import C is not a valid import. In fact, the correct symbol is c (lower-case).
The same happens with the pickle version of AutoImport.
Editor information:
Project Python version: 3.10.13
Rope Python version: 3.10.13
Rope version: 1.10.0
Text editor/IDE and version: N/A
The text was updated successfully, but these errors were encountered:
IIUC, this is likely intentional because one of the way autoimport can be used is for adding imports automatically when autocompleting names that aren't in the current scope, this is how autoimport is implemented in pylsp's builtin autoimport for example.
For the use case of autoimport of the symbol under cursor, this behavior might not necessarily be desirable, so it might make sense to make this behavior configurable.
The method is kept for compatibility with the old API, using exact matches would make sense for this.
I cannot reproduce the same behavior in pickle, only sqllite.
This method isn't used in the pylsp completion engine, so I'll change it to match pickle.
Describe the bug
AutoImport's
get_modules
is case insensitive. Not sure if exactly a bug, but I don't think this behavior fits considering the method is used for full names and not for autocompletion purposes.To Reproduce
The code above prints
['calendar']
butfrom calendar import C
is not a valid import. In fact, the correct symbol isc
(lower-case).The same happens with the
pickle
version ofAutoImport
.Editor information:
The text was updated successfully, but these errors were encountered: