Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

searchImport not finding modules #5843

Open
kdkavanagh opened this issue May 2, 2024 · 4 comments
Open

searchImport not finding modules #5843

kdkavanagh opened this issue May 2, 2024 · 4 comments
Assignees
Labels
waiting for user response Requires more information from user

Comments

@kdkavanagh
Copy link

I dont have enough information yet to provide a reproducible example, but to first describe the issue:

I'm observing that VSCode quick-fix and autoimport functionality are unable to find symbols in a specific python package installed as a dependency in a virtualenv for the project I'm working on. However, once I manually import the module, vscode recognizes it / is able to jump to the source / etc (in other words, once it's told to import the module, everything works as expected). This has only recently become an issue afaik, but is still working for other installed python packages.

When prompted to "search for additional import matches", it is able to find the root name of the package in question but no submodules/symbols below that.

Is it possible to print the search paths that searchImports is using to try to debug further to provide more information here? Currently have pylance/python log levels set to trace but nothing interesting is popping up.

Environment data

  • Python 3.11
  • vscode Version: 1.88.1
  • vscode-python: v2024.5.11021008
  • vscode-pylance: v2024.4.1
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label May 2, 2024
@heejaechang
Copy link
Contributor

heejaechang commented May 2, 2024

you need to use python.analysis.packageIndexDepths. see https://github.com/microsoft/pylance-release/blob/main/README.md#settings-and-customization for more detail.

due to perf reason, we only index top level symbols by default.

Just remember, the deeper you go (more submodules), the bigger the performance hit you get (more symbols to show, more files to scan/index). Also, take a look at other option and command around persisting indices and clearing persisted indices.

@heejaechang heejaechang added by design and removed needs repro Issue has not been reproduced yet labels May 2, 2024
@kdkavanagh
Copy link
Author

I do already have that variable set:

 "python.analysis.packageIndexDepths": [
        {
            "name": "thePackageName",
            "depth": 50,
            "includeAllSymbols": true,
        }
    ],

@kdkavanagh
Copy link
Author

As well as these other settings:

"python.analysis.autoImportCompletions": true,
"python.analysis.userFileIndexingLimit": -1,
"python.analysis.persistAllIndices": true,

@heejaechang heejaechang reopened this May 2, 2024
@heejaechang
Copy link
Contributor

heejaechang commented May 2, 2024

I see. then if you can share repro steps or at least trace log, it would give us some data to take a look.

repro step would be best, if not, the log and probably where your package is installed and every setting you have if it is not included in the log already.

@heejaechang heejaechang added waiting for user response Requires more information from user and removed by design labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for user response Requires more information from user
Projects
None yet
Development

No branches or pull requests

3 participants