Closed MaxG87 closed 3 years ago
I'm coming across the same issue in VS Code running Jedi for IntelliSense. It seems the underlying issue is that Jedi has trouble resolving doc strings on decorated functions. The Jedi maintainer seems to have updated the code to interpret the built-in @wraps
decorator correctly but this doesn't seem to extend to Hypothesis' function wrapper mechanisms.
It seems that most strategies are decorated by the @cacheable
decorator, preventing Jedi from properly introspecting them. On the other hand, the undecorated just()
and one_of()
strategies present proper type annotations and auto-completion when used:
The solution here could be to rely more heavily on @wraps
to wrap decorated functions — alternatively, this may be an upstream issue in the Jedi repository.
We would definitely like autocompletion to work - it's on the list, but we have more things to work on than volunteer time and switching to @functools.wraps
would break lots of other things :cry:
@Zac-HD, that makes sense — this is a wonderful library by the way; keep up the great work!
For other users stumbling onto this issue and are using VS Code, I had some luck with the pyright
extension. It seems to work but is a little ugly as it appends its results to Microsoft's default Python
extension in the pop-out tooltip. Nonetheless, it's been pretty useful so far and I highly recommend it.
@MaxG87, if you're still having trouble with this, there is also coc-pyright
, which appears to work on NeoVIM, but maybe there's a way to get it to work in vanilla VIM as well.
@MaxG87, if you're still having trouble with this, there is also
coc-pyright
, which appears to work on NeoVIM, but maybe there's a way to get it to work in vanilla VIM as well.
Thank you very much. I'll give it a try.
I don't know what happened, but today everything worked out. Maybe its due to improvements on Hypothesis, maybe the packages got better. Anyhow, docstrings can be shown and code completion works.
Thank you very much!
I use Hypothesis with great enthusiasm. However, I have issues with its code completion.
A minimal environment could be created via
A test python file would be:
Using
mypy
detects erroneous usage:However,
jedi-vim
is not able to pick up the definitions. Thus, neither code completion nor displaying the doc string do work. On the other hand, PyCharm manages to to so.On tweak I tried out was to adapt the python path.
This gives completion for
st.intege
, but still no docstring detection and still no argument completion.Other packages, e.g.
requests
work flawlessly.I would be very glad if I hypothesis would support the IDE-like setup that is common to many Vim users.