New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dedup redundant type/kind info by simplifying full signature generation #179
Conversation
I agree, there's some redundancy that we should address. That said, there are a couple issues with this PR:
Based on your feedback, I think I have a clear idea of what we're looking for. I'll create a new PR later today with some updates and add you as a reviewer for feedback. |
Thanks for the feedback, and I agree that having the return type and hinted type is helpful. If I find some time as well, I may iterate upon this PR to see if I can extend to cover the two issues you highlighted, if you don't mind. |
@pappasam I updated the PR with a WIP commit addressing the two issues. However, it appears that calling import os
os. In Neovim, I am resolving eagerly to get the What about splitting the difference? Use the original method for normal completion requests and use |
The slowness is especially felt when I start using nvim-cmp for autocompletion. I'll keep experimenting if there is a cheaper way to get the return type if it is present in the signature. |
Invoking If the code is explicitly typed, @pappasam, how about this: What if we evolve the default completion request to provide the |
For completions that don't have a signature, `BaseName.description` provides type, name, and typing information if it was explicitly written. For completions that provide signatures, `.to_string` provides the parameters and typing information that needs to be appended to the type. `get_type_hints()` is an expensive call that calls into `jedi.infer()`, even for completions that have explicit typing information.
This partially reverts commit 8ee2138 by restoring the former expected behavior for how the header is rendered when hovering over a module due to the simplified approach for obtaining the full signatures.
I've updated this PR blending both approaches to address having return types in function signatures if they are explicitly typed, With this approach, the completion text is verbatim what is in the source code and this plays with with autocompletion plugins when fetching completions while typing. |
Woah — I discovered that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! I think that, given the performance trade-offs you've identified, we should move forward with this as soon as possible
Thanks! Glad I could help out and I learned a few things along the way 😄 . |
For completions that don't have a signature,
BaseName.description
provides type, name, and typing information if it was explicitly
written. For completions that provide signatures,
.to_string
providesthe parameters and typing information that needs to be appended to the
type.
get_type_hints()
is an expensive call that calls intojedi.infer()
,even for completions that have explicit typing information.
This partially reverts commit 8ee2138
by restoring the former expected behavior for how the header is rendered
when hovering over a module due to the simplified approach for obtaining
the full signatures.
Closes: #178