I can’t get PyCharm to hint methods for libcpp library for example for vector container.
This is my code:
from libcpp.vector cimport vector
cdef vector[int] v
v.push_back(1)
PyCharm can’t see methods of v, like size() or push_back(), so it won’t hint them. How do I make it work? Cython is installed.
I tried setting up a new project in PyCharm. Tried reinstalling Cython. Tried different kind of imports, different kind of declarations like v: vector[int]
2
This is to be expected: those bindings require that the IDE has “understanding” of C/C++ code, which isn’t the case for pycharm by default as far as I know
I believe the cyright LSP server is able to check / provide hints for cimport
, so you may be able to make it work in pycharm using the LSP plugin.
In particular, this is how this VSCode plugin achieves the expected result.