Enhance autocomplete/tooltip of function which uses ParamSpec
and the signature ends with *args: P.args, **kwargs: P.kwargs
#2634
Replies: 4 comments
-
What you're suggesting is that pylance "solve the type variables and param specs" for a partially-completed call. I think that might be viable in the very specific case that you've highlighted in your example, but it will lead to misleading (and incorrect) signatures in the more general case. So if we were to add this, it would need to be limited specifically to the case for ParamSpecs where the signature ends with |
Beta Was this translation helpful? Give feedback.
-
I think this pattern is somewhat common: I have come across this call pattern in TypeScript quite a bit and its trivial to type it and autocomplete/tooltip works fine: function registerCallback<Fn extends (...args: any) => any>(func: Fn, ...args: Parameters<Fn>): void {
//
}
function foo(options: {foo: string, nums: Array<number>}): boolean {
return true;
} |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
+1 would like this. |
Beta Was this translation helpful? Give feedback.
-
Take the following snippet:
When I write
run_in_threadpool(foo,
the tooltip shows me the following:I think it would be a better user experience if it was able to show me args and kwargs of
foo
.Beta Was this translation helpful? Give feedback.
All reactions