Visual Studio 代码 IDE 自定义函数的自动建议函数

Visual Studio Code IDE auto propose function for custom functions

我创建了一些自定义函数,但我发现当我输入 'the dot' 语法时,没有自动建议函数屏幕提示。有没有什么配置。我不见了?

下面是我在包“ws_functions”中的文件结构。

谢谢。

您使用的 pylance 需要 extraPaths 设置才能使智能感知在子目录中正常工作(他们确实需要修复此问题)。

在项目的根目录中创建一个目录 .vscode,然后在该文件夹中创建一个 settings.json 文件。编辑settings.json的内容如下:

{
  "python.analysis.extraPaths": ["ws_functions"] // the name of your project folder dirctory
}

现在您应该能够:

from . import config # or another file

# intellisense should show completions
config.

有关详细信息,请参阅此处:https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings