Is there a quick how to on getting autocompletion ...
# python
b
Is there a quick how to on getting autocompletion to work for Python in VSCode?
I'm using Zed editor with Pulumi but you can install pyright in your VSCode and configure to read your virtualenv too, e.g:
pyrightconfig.json
Copy code
{
  "venvPath": ".",
  "venv": "venv",
  "typeCheckingMode": "off"
}
a
You have to enable indexing and then you can configure the index depth if you want to increase that to include nested submodules – see relevant
settings.json
configuration values below. However, depending on the Pulumi provider SDK and the amount of symbols, VScode might hit the 4GB memory limit and blow up. For that reason I haven't been able to increase the indexing depth for
pulumi_azure_native
above 2 which in that case excludes versioned
vYYYYMMDD
API submodules. I also want to set the
diagnosticMode
to analyze the whole
workspace
and not just
openFilesOnly asdf
to show typing errors in my whole project. And even with indexing depth set to 2 levels this will make VScode on my M1 Mac really sweat with noticeable load surges and I have to take care to be specific with imports (always use
from pulumi_x import y
instead of
import pulumi_x
) so it won't trigger a major indexing. Either the IDE indexers need to become much more clever/performant or Pulumi provider SDKs need to be split up.
Copy code
{
    "python.analysis.indexing": true,
    "python.analysis.packageIndexDepths": [
    {
      "name": "pulumi",
      "depth": 2
    },
    {
      "name": "pulumi_azure_native",
      "depth": 2
    },
    {
      "name": "pulumi_azuread",
      "depth": 2
    },
    "python.analysis.diagnosticMode": "workspace",
}