feat: Improve VSCode experience (type hints, docs, etc)
Is your feature request related to a problem?
Other than basic completions, most "intellisense" seems to be lacking in VSCode:
- No parameter hints with C-S-Space
- No help popup with C-K C-I
Most of the time I need to run stuff like t.agg? which is not ideal.
What is the motivation behind your request?
No response
Describe the solution you'd like
Improve static hints or whatever it's needed. I assume basic completions are working because I enabled "jupyter.enableKernelCompletions": true but that's as far as it goes.
What version of ibis are you running?
10.8.0
What backend(s) are you using, if any?
No response
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Are you familiar at all with what we would need to do for vscode to pick up on this stuff? Like we have docstrings and often have type hints, what else do we need to do? Can you give a screenshot of some other python library that does this well, so I can
- see what expected behavior is
- go see how they have implemented this?
AFAIK we are not doing anything special that would prevent these kinds of things from working.
I regularly use the neovim equivalents of these features such as type hints and docs in pop-up menus, for example.
I started tracking some issues we've had a while back, but seems I forgot to follow up 😅
- https://github.com/narwhals-dev/narwhals/issues/2960
@MarcoGorelli have there been any more recent pain points?
to show a few examples (the first just shows Deferred, the second doesn't show anything)
for contrast:
I think part of the issue is that a lot of Deferred is hidden behind __getattr__, which is fine at runtime but not for static analysis
https://github.com/ibis-project/ibis/blob/0938c478eb5f24ddab9af1a0f1dd17a8cb7086ff/ibis/common/deferred.py#L98-L101
Another is that, although there are some type annotations, they're not checked in CI
Part of the issue here is that the inherited methods are not typed with Self or @overloads.
For example, NumericColumn inherits __add__ from NumericValue, which is typed as def __add__(...) -> NumericValue:. Thus Pylance thinks numeric_col1 + numeric_col2 is just a NumericValue, not a NumericColumn, and complains (and doesn't offer autocomplete, docstrings, etc.) if you try to then do, e.g., .sum().
Thanks @ajmarks, that is the sort of specific improvement we can make. I opened https://github.com/ibis-project/ibis/pull/11771 to fix that.