Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Please improve pylance's parameter prompt layout style and provide function documentation #301

Closed
CatNofishing opened this issue Aug 31, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@CatNofishing
Copy link

Compared with jedi, pylance's parameter prompt typesetting is too dense and not suitable for reading. In addition, for the same function, pylance only has parameter prompts, but no function documentation.
image
image

@judej judej added the enhancement New feature or request label Aug 31, 2020
@github-actions github-actions bot removed the triage label Aug 31, 2020
@CatNofishing
Copy link
Author

@jakebailey
Copy link
Member

I had thought the original issue here would be fixed by the fixes for type aliases over-expanding, but it appears not:

image

Even though this is defined as:

def scatter(
    x: ArrayLike,
    y: ArrayLike,
    s: Optional[Union[Scalar, ArrayLike]] = ...,
    c: Optional[Union[_ColorLike, Sequence[float], Sequence[_ColorLike]]] = ...,
    marker: Optional[MarkerStyle] = ...,
    cmap: Optional[Colormap] = ...,
    norm: Optional[Normalize] = ...,
    vmin: Optional[Scalar] = ...,
    vmax: Optional[Scalar] = ...,
    alpha: Optional[Scalar] = ...,
    linewidths: Optional[Union[Scalar, ArrayLike]] = ...,
    verts: Optional[Any] = ..., # not documented?
    edgecolors: Optional[Union[Literal["face", "none"], _ColorLike, Sequence[_ColorLike]]] = ...,
    *,
    plotnonfinite: bool = ...,
    data: Optional[Any] = ...,
    **kwargs: Any
) -> PathCollection: ...

And should be displayed much smaller thanks to the aliases.

@erictraut
Copy link
Contributor

erictraut commented Oct 7, 2020

Aliases are still expanded when used within unions because the resulting union needs to be deduped. I don't see any straightforward way to avoid this. Typescript also expands type aliases for unions.

@jakebailey
Copy link
Member

I can understand within a union (unfortunate), but ArrayLike is an alias itself and its name is being elided for the x and y parameters.

@erictraut
Copy link
Contributor

Yes, you're correct @jakebailey. There are places where the the type checker was transforming types unnecessarily and removing the type alias information in the process. I've checked in a fix, and the ArrayLike alias is now preserved. I don't know if this change will make it into this week's Pylance build. It might be too late. If not, it will be in the following release.

@jakebailey
Copy link
Member

I'll try to sneak it in. The fix saves a few lines, though the nested unions still get expanded (as you said).

image

image

@jakebailey
Copy link
Member

Okay, I've gotten it in. I won't mark this issue as closed quite yet (as I believe this is the overall tracking issue for "tooltips are too big").

@CatNofishing
Copy link
Author

☺Thanks for your reply!

@CatNofishing
Copy link
Author

To be honest, the readability of parameter prompts is really poor. You can't even quickly distinguish which one is the formal parameter and which is the default parameter. You have to scan such a long function signature one by one, and there is no function document

@yvvt0379
Copy link

yvvt0379 commented Jul 17, 2021

@jakebailey @erictraut Here's my suggestions, and it's up to you to accept or reject: We can show types in a non-monospaced font(say, Segoe UI) and/or in smaller sizes so that they will occupy less space, and in a different background color to make it easier to distinguish them and parameter names apart.

@jakebailey jakebailey removed their assignment Sep 2, 2021
@judej judej removed the in backlog label Mar 22, 2022
@judej
Copy link
Contributor

judej commented Apr 19, 2022

Moving this issue to discussion as an enhancement request for comments and upvotes.

@microsoft microsoft locked and limited conversation to collaborators Apr 19, 2022
@judej judej converted this issue into discussion #2628 Apr 19, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants