Skip to content
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

Improve formatting of parameter hints (call tooltips) #1849

Closed
memeplex opened this issue May 15, 2019 · 7 comments
Closed

Improve formatting of parameter hints (call tooltips) #1849

memeplex opened this issue May 15, 2019 · 7 comments

Comments

@memeplex
Copy link

Environment data

  • VS Code version: 1.33.1
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: Arch Linux
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3

Expected behaviour

Tooltip text flows naturally disregarding hard breaks in the original docstring.

Actual behaviour

Natural text flow is interrupted because of the interaction between the width of the tooltip popup and the location of hard breaks in the docstring (which assume a larger viewport).

image

ISSUE HERE

of several
input
planes

Hardbreak after "input" interrupt the natural flow.

Steps to reproduce:

JEDI AS INTELLISENSE IS SELECTED

  1. Create a python file
  2. import torch
  3. torch.nn.Conv2d(
  4. wait for the signature help

Some suggestions

Many editors (vscode included) provide heuristic text formatters as builtins or as extensions.

Moreover, font size could be reduced (indeed, for a tooltip, current size looks too big). Atom does this and the popups are really not much larger than vscode ones, but the layout of the text is superior.

Related issues

microsoft/vscode-python#5577, microsoft/vscode-python#5610, microsoft/vscode#14165,
microsoft/vscode#38663

Some of the referenced issues suggest that changes upstream could improve the situation for vscode-python, but anyway I believe there still is room for improvement and no popup width short of 80 characters will ever be right, anyway.

@karrtikr
Copy link

karrtikr commented May 15, 2019

I don't see a "hardbreaks" issue with argparse.ArgumentParser. That is separate issue taken care in microsoft/vscode-python#5577
The "hardbreaks" issue occurs with torch.

I have edited the issue accordingly.

@memeplex
Copy link
Author

This is interesting, notice how well the documentation for os is formatted here:

image

There original has hard breaks like this:

Programs that import and use 'os' stand a better chance of being
portable between different platforms.  Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).

Some kind of processing is happening there, don't you think?

@karrtikr
Copy link

Agree, can you please comment these queries on the upstream jedi issue. The maintainers of jedi would know more about it.

@memeplex
Copy link
Author

Do these better formatted queries also come already formatted from jedi?

@luabud
Copy link
Member

luabud commented Jun 18, 2019

We do post-processing of this

@DarkSystemCD
Copy link

DarkSystemCD commented Feb 20, 2021

productivity with parameter hint in vscode could have monospace font and rendered in pre tag by default;

how to write in free typing, consistent documentation in vscode [?]
since vscode is built in css and html,
you developers could just add a pre tag with monospace font where parameter hint custom content are rendered;

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Sep 21, 2021
@jakebailey
Copy link
Member

As with #1848, I believe this is fine in Pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants