Visual Studio How to add Python module to Intellisense

℡╲_俬逩灬. 提交于 2019-12-18 04:32:29

问题


How do I add a custom python module to the Visual Studio IntelliSense code completion tool?

Situation: I am working on a python module that references another module that I have saved in /myPython/foo.py.

If I start to type foo.someDef I would like IntelliSense to recognize I am accessing that module and suggest a code completion.


回答1:


Visual Studio's Intellisense will recognize custom Python modules after they have been properly placed in the "site-packages" folder under the "Lib" folder in Python's directory.

For example: /Python27/Lib/site-packages/myPython

Inside of the folder "myPython", put a plain text file called "__init__.py". Otherwise Intellisense will not recognize your package.

You may also have to click the "Refresh DB" under the Python Environments tab.




回答2:


Hello, this is the new ai enabled intellicode plugin for VS 2017 (python). You can install it and test the result. https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.VSIntelliCode Turn intellisense database !OFF! by setting -> tools->options->python->experimental->!ON!

Now it works with the new ai-based intellicode.

There may be a short delay-time, which is ai-backend-communication-referred (https://prod.intellicode.vsengsaas.visualstudio.com/). But after a short time you get all intellicode informations - may be - perhaps it may last one day :) ). Repeat the dot several times if necessary.

Best Axel Arnold Bangert - Herzogenrath 01.2019



来源:https://stackoverflow.com/questions/30605416/visual-studio-how-to-add-python-module-to-intellisense

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!