【发布时间】:2019-05-03 20:07:49
【问题描述】:
在 VS Code 中,我尝试导入一个名为 foo.py 的模块,该模块的类型提示为 stub file foo.pyi。我想根据.pyi 文件中的类型提示获取代码自动补全,如PyCharm does。但是,.pyi 文件似乎没有任何效果。有谁知道这个功能是否支持?
【问题讨论】:
标签: python visual-studio-code type-hinting mypy
在 VS Code 中,我尝试导入一个名为 foo.py 的模块,该模块的类型提示为 stub file foo.pyi。我想根据.pyi 文件中的类型提示获取代码自动补全,如PyCharm does。但是,.pyi 文件似乎没有任何效果。有谁知道这个功能是否支持?
【问题讨论】:
标签: python visual-studio-code type-hinting mypy
如果您使用Pylance language server 应该支持它,它将设置"python.languageServer": "Pylance" 作为安装它的副作用。
【讨论】:
typings 或 stubs 的子文件夹中?或者别的什么
.pyi 文件位于 .py 文件旁边,它提供了类型提示。