Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does VSCode support Python .pyi files for IntelliSense?

In VS Code, I tried importing a module called foo.py that has a type hinting stub file foo.pyi. I want to get code autocompletion based on the type hints in the .pyi file, as PyCharm does. However, the .pyi file does not seem to have any effect. Does anyone know if this feature is supported?

like image 912
RexE Avatar asked Dec 02 '18 07:12

RexE


People also ask

How do I get Python IntelliSense in VS Code?

Install Python and the Python extension# For a quick install, use Python from python.org and install the extension from the VS Code Marketplace. Once you have a version of Python installed, activate it using the Python: Select Interpreter command.

Why IntelliSense doesn't work in VS Code?

Why is VS Code suggestions not working? If you're coding in JavaScript or TypeScript and finds that VSCode IntelliSense does work but does not behave properly, it's likely that you've selected the wrong language mode. TypeScript and JavaScript share the same language service, so you need to select the right language.

Why is VS Code not recognizing Python import?

The message simply means that VSCode cannot detect the correct path for a Python module. The cause of "Unresolved Import" could be one of the following reason: VSCode is using the wrong Python path. This is often the case if you're running your code against a virtual environment.

Is VS Code recommended for Python?

One of the coolest code editors available to programmers, Visual Studio Code, is an open-source, extensible, light-weight editor available on all platforms. It's these qualities that make Visual Studio Code from Microsoft very popular, and a great platform for Python development.


1 Answers

It should be supported if you use the Pylance language server which will set "python.languageServer": "Pylance" as a side-effect of installing it.

like image 146
Brett Cannon Avatar answered Sep 21 '22 23:09

Brett Cannon