pythonvisual-studio-codeautocompleteintellisense

VSCode: Add custom autocomplete to known external classes


I'm working with Python in an environment where there are some classes which are defined externally (as in, I don't have access to the files where these classes are defined). So I can import these classes and use them, but since VSCode can't resolve the import, there's no autocomplete for them.

What I would want: a way to tell VSCode which attributes and methods these classes have, so it can autocomplete for me whenever I use them (same as if I had these classes defined in my workspace and imported normally). Is this possible somehow?


Solution

  • Autocomplete and IntelliSense are provided for all files within the current working folder in VSCode. They're also available for Python packages that are installed in standard locations.

    To enable IntelliSense for packages that are installed in non-standard locations, add those locations to the python.analysis.extraPaths collection in your settings.json file.

    Ref:https://code.visualstudio.com/docs/python/settings-reference#_autocomplete-settings