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

Remove autocomplete.preloadModules #1704

Closed
asierralozano opened this issue May 16, 2018 · 14 comments
Closed

Remove autocomplete.preloadModules #1704

asierralozano opened this issue May 16, 2018 · 14 comments
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@asierralozano
Copy link

asierralozano commented May 16, 2018

Environment data

  • VS Code version: 1.23.1
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: CentOs 7
  • Python version (& distribution if applicable, e.g. Anaconda): Python2.7
  • Relevant/affected Python packages and their versions: Autodesk Maya completion module

Actual behavior

Referencing this question: https://stackoverflow.com/questions/49912163/vscode-add-preloaded-module-from-extrapath/49926294#49926294

I have added the maya's completion path to python.autocomplete.extraPaths(/Applications/Autodesk/maya2018/devkit/other/pymel/extras/completion/py) available to download by the Autodesk Maya's DevKit, because I would like to have the intellisense working with those modules.

Then, i have also added the module "maya" to python.autocomplete.preloadModules, because I would like to speed up the intellisense, but I think that is not working at all. It takes like 10 seconds to show the intellisense options

Steps to reproduce:

1- You can download the Maya's DevKit with it's own autocomplete modules from here:
https://apps.autodesk.com/MAYA/en/Detail/Index?id=5525491636376351277&os=Win64&appLang=en

2- Unzip the file, and add the folder to python.autocomplete.extraPaths (In my case, the one that I told you above)

3- Add the maya module to python.autocomplete.preloadModules

4- Try restarting VSCode and importing the module with the following snippet:

import maya.cmds as cmds

Let me know if you need some more info!

Thanks for this amazing Extension and for your hard work!

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs verification labels May 17, 2018
@Schronuman
Copy link

I have met the same situation using the numpy.
Even though I have added it to the python.autocomplete.preloadModules , the autocomplete still has a 2-4 seconds lag. Such a problem is really painful.

@brettcannon
Copy link
Member

Yes, it looks like preloading isn't doing anything.

@TylerGubala
Copy link

TylerGubala commented Jul 8, 2018

I'm trying to get Blender as a Python module to work and am facing an issue where I can't get the autocompletion and linting to work in Visual Studio Code.

If you pip install bpy into a venv and set your python interpriter to the venv's interpriter you will see what I mean.

import bpy

import bpy.type[...]
[Loading...]

but it never loads the auto completion. As soon as you put in the dot between bpy and start typing types it should intellisense, but it's not working for some reason.

Is there something I'm doing wrong?

The bpy.pyd is working fine in the interactive interpriter.

OS: Windows 10 Pro 64 bit
Python Version: Python 3.6.5 64bit

@asierralozano
Copy link
Author

Does this new languageServer fix this issue? Or it is not related at all?

@brettcannon
Copy link
Member

@asierralozano it isn't related

@lucasrabelo
Copy link

I have the same problem. Vs Code shows a lot of code but none related to the module. And the annoying part is if you press enter, it will import a lot of nonsense

@brettcannon brettcannon added the important Issue identified as high-priority label Aug 2, 2018
@ssunno
Copy link

ssunno commented Aug 24, 2018

I have the same issue using tensorflow.
It seems to "python.autoComplete.preloadModules": ["tensorflow"] do not working properly.

@brettcannon
Copy link
Member

We should make sure to check if both Jedi and the language server exhibit this bug.

@DonJayamanne
Copy link

I can confirm we're procecssing preloadModules correctly and the fact that these settings are being passed onto Jedi correctly (I.e. jedi is in fact pre-loading them).
Looks like Jedi is slow at pre-loading this completion list.

We should make sure to check if language server exhibit this bug.

Language server does not utilize this setting, as it doesn't have the ability to pre-load modules.
I've tested this with the language server and it seems to work very well.

E.g. intellisense for tensorflow takes approx 8 seconds on my Mac with Jedi, however with the new language server it takes ~1 second.

@ssunno @asierralozano @TylerGubala @TylerGubala
Please could you try the new language server.
Please install the latest development version of the extension from here and update your settings.json as follows "python.jediEnabled": false

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster and removed needs PR labels Sep 20, 2018
@DonJayamanne DonJayamanne self-assigned this Sep 20, 2018
@brettcannon brettcannon changed the title Module in autocomplete.preloadModules not picked up Remove autocomplete.preloadModules once the language server becomes the default Sep 20, 2018
@brettcannon brettcannon added needs PR and removed important Issue identified as high-priority info-needed Issue requires more information from poster labels Sep 20, 2018
@brettcannon brettcannon changed the title Remove autocomplete.preloadModules once the language server becomes the default Remove autocomplete.preloadModules Sep 20, 2018
@brettcannon
Copy link
Member

If Jedi is doing the right thing but isn't meeting people's expectations and the setting makes no sense for the language server then we should probably consider dropping the setting (we can either fully deprecate it or simply remove the setting visibly so those that have it can continue to have it work for them).

@DonJayamanne
Copy link

Agreed.

@asierralozano
Copy link
Author

asierralozano commented Sep 21, 2018

Hello!

I was trying the newest language server, and it seems that, for example, with the Autodesk Maya module, VSCode is showing up the autocomplete suggestions very quickly!

So it looks like it is a Jedi issue, and with the newest language server is working so smooth!

@SheepDomination
Copy link

If understood correctly I have to set "python.jediEnabled": false within the user settings.json file; but, how are modules still being loaded if "python.autoComplete.preloadModules": is not used ?

@brettcannon
Copy link
Member

@SheepDomination "python.jediEnabled": false turns on the new language server. Modules are still loaded because both Jedi and the language server look at sys.path and what code you import for where to look. The preloadModules was just an optimization to automatically process files even if you didn't open a file that imported them.

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

10 participants