Vscode code autocompletion for Taichi seems not working

Hi there,
I think I have already set the right configuration of Vscode python extension by adding

    "python.autoComplete.extraPaths": [
        "/home/lizhehao/.local/lib/python3.8/site-packages"
    ]
}

into my settings.json.

However, the python code autocompletion seems not working for Taichi:

While it works for numpy, where numpy and taichi are in the same site-packages folder.

There may be some mistakes in my Vscode code autocompletion settings, if you know please tell me, and thx for any reply!

Finally I use PyCharm and it works fine. :sweat_smile:

2 个赞

Oh no, I face the same problem. Autocompletion for taichi in vscode is not working properly, but I don’t want to switch to pycharm though…

  • Add site-packages into python.analysis.extraPaths too.
  • And if something(like ti.lang.ScalarField) still not works, add a line from taichi import lang into the file taichi/__init__.py.

However this cannot solve all the problems. For example, ti.Vector.field still cannot be recognized.

I think this is a flaw of vscode’s Python extension or its language server, which cannot detect the properties added dynamicly, such as Vector.field = Matrix._Vector_field.