DangerousTim
DangerousTim

Reputation: 95

How to make VSCode Intellisense work with Python bindings of C++ code?

I am using a library called GTSAM written in C++ that has a nice Python wrapper made with pybind11. However, VSCode's Intellisense auto-complete feature doesn't seem to work with this module, i.e. it is unable to give suggestions and cannot recognize methods in the provided examples. This is not a major problem but it does make writing code a little tiresome.

I've tried adding this to settings.json (and reloading the window) according to this suggestion:

 "python.autoComplete.extraPaths": [
     "~/.local/lib/python3.8/site-packages/gtsam"
 ],
 "python.analysis.extraPaths": [
     "~/.local/lib/python3.8/site-packages/gtsam"
 ]

But this hasn't worked. Is there something else one has to do to make the above trick work? That suggestion above mentions Intellisense automatically picking the pydoc; how does that happen exactly and how can I make it work for my case?

Or is there some other way for Intellisense to refer to the C++ code itself that the wrapper is referring to?

I'm working on Ubuntu 20.04 on WSL2 with Python3.8

Upvotes: 6

Views: 758

Answers (0)

Related Questions