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

Docstrings are truncated even when expanding completion pop-up window to maximum size #211737

Open
V4n1sh opened this issue Apr 26, 2024 · 9 comments
Assignees

Comments

@V4n1sh
Copy link

V4n1sh commented Apr 26, 2024

Behaviour

The tooltip for the docstring that pops up when entering a partial function name is truncated, causing long lines to be cut off.

Steps to reproduce:

  1. Defining a function with long docstring input.

1

  1. Entering the function name letter by letter, the docstring tooltip show up

  2. Viewing the tooltip and find the long line truncated.

2

  1. When you've entered the full name of the function and move your mouse point hover to the function name, the docstring is shown normal.

3

Hope it'd be fixed.

Best wishes.

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 29, 2024
@heejaechang
Copy link

one is completion tooltip and the other is hover tooltip. can you resize tooltip window of completion tooltip? unlike hover tooltip, completion tooltip won't show horizontal scrollbar for long text.

but FYI, completion tooltip resize allows you to resize up to vscode window size so, if doc string require bigger window than vscode window, then you won't be able to see it.

we might need to ask vscode to improve vscode.

@V4n1sh
Copy link
Author

V4n1sh commented Apr 30, 2024

one is completion tooltip and the other is hover tooltip. can you resize tooltip window of completion tooltip? unlike hover tooltip, completion tooltip won't show horizontal scrollbar for long text.

but FYI, completion tooltip resize allows you to resize up to vscode window size so, if doc string require bigger window than vscode window, then you won't be able to see it.

we might need to ask vscode to improve vscode.

Certainly, I can resize the tooltip window for completion tooltip. However, even if I resize the window to its maximum size, the text may still be truncated. It seems that if completion tooltips could wrap text like hover tooltips, it would greatly improve the usability.

@V4n1sh
Copy link
Author

V4n1sh commented Apr 30, 2024

def paragraph(nb_sentences: int = 3, variable_nb_sentences: bool = True, ext_word_list: list[str] | None = None) -> str:
        """
        Generate a paragraph.
        The nb_sentences argument controls how many sentences the paragraph
        will contain, and setting variable_nb_sentences to False will
        generate the exact amount, while setting it to True (default) will
        generate a random amount (+/-40%, minimum of 1) using
        randomize_nb_elements().
        Under the hood, sentences() is used to generate the sentences, so the
        argument ext_word_list works in the same way here as it would in
        that method.
        
        Examples:
        
        
        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.paragraph(nb_sentences=5)
        ...
        'American whole magazine truth stop whose. On traditional measure example sense peace. Would mouth relate own chair. Role together range line. Government first policy daughter.'
        'Kind miss artist truth trouble behavior style. Ability management test during foot that course nothing. Sound central myself before year. Your majority feeling fact by four two. White owner onto knowledge other. First drug contain start almost wonder.'
        'Attorney quickly candidate change although bag record. Raise study modern miss dog Democrat quickly. Often late produce you true soldier. Food break onto friend.'
        'Administration even relate head color. Staff beyond chair recently and off. Own available buy country store build before. Already against which continue.'
        'Decision song view age international big employee. Author feeling job article level. Beyond write current grow rule stuff truth college.'
        
        
        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.paragraph(nb_sentences=5, variable_nb_sentences=False)
        ...
        'Serious inside else memory if six. Whose group through despite cause. Sense peace economy travel. Total financial role together range line beyond its. Policy daughter need kind miss artist truth trouble.'
        'Rest human station property. Partner stock four. Region as true develop sound central. Language ball floor meet usually board necessary. Natural sport music white.'
        'Natural explain before something first drug contain start. Party prevent live. Quickly candidate change although. Together type music hospital. Every speech support time operation wear often.'
        'Manage political record word group food break. Picture suddenly drug rule bring determine some forward. Beyond chair recently and. Plant view own available buy country store. Hospital have wonder already.'
        'Create wife responsibility. Decision song view age international big employee. Author feeling job article level. Beyond write current grow rule stuff truth college. Whom around put suddenly garden.'
        
        
        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.paragraph(nb_sentences=5, ext_word_list=['abc', 'def', 'ghi', 'jkl'])
        ...
        'Abc jkl def jkl jkl jkl. Ghi jkl ghi def jkl ghi. Jkl ghi ghi ghi abc. Ghi jkl ghi def. Def def ghi abc.'
        'Def ghi abc jkl jkl abc jkl. Abc def jkl abc def jkl abc ghi. Jkl abc ghi abc jkl. Jkl def def def abc def jkl. Jkl ghi ghi def ghi. Def abc abc jkl abc jkl.'
        'Abc ghi abc abc abc abc ghi. Ghi jkl ghi ghi abc abc ghi. Ghi def ghi jkl jkl jkl. Def abc ghi def.'
        'Abc def ghi def abc. Jkl abc abc ghi abc ghi. Ghi abc abc abc jkl abc abc. Abc abc jkl abc.'
        'Abc jkl jkl abc def abc def. Abc def def abc def. Abc jkl abc def ghi jkl jkl abc.'
        
        
        >>> Faker.seed(0)
        >>> for _ in range(5):
        ...     fake.paragraph(nb_sentences=5, variable_nb_sentences=False, ext_word_list=['abc', 'def', 'ghi', 'jkl'])
        ...
        'Jkl def def ghi def jkl. Jkl def jkl abc abc. Jkl ghi def jkl. Jkl def ghi jkl ghi def abc def. Ghi abc ghi def ghi abc jkl jkl.'
        'Ghi def jkl ghi. Ghi jkl def. Ghi abc jkl abc jkl abc. Def abc def ghi jkl abc ghi. Ghi jkl ghi jkl.'
        'Ghi def abc jkl def abc abc jkl. Ghi ghi def. Ghi abc abc abc. Jkl jkl ghi def. Def jkl jkl jkl ghi jkl ghi.'
        'Def ghi ghi jkl def def abc. Ghi jkl abc ghi abc abc jkl def. Abc abc ghi abc. Ghi jkl ghi abc abc abc jkl. Def def jkl abc.'
        'Abc jkl ghi. Abc jkl jkl abc def abc def. Abc def def abc def. Abc jkl abc def ghi jkl jkl abc. Jkl abc ghi jkl def.'
        
        
        
        """
        pass

Above is the python function with very long docstring, hope it's helpful.

@heejaechang
Copy link

heejaechang commented Apr 30, 2024

@luabud should we transfer this feedback to vscode team? UI (and resize) is owned by the platform (vscode).

that said, we might create view only for doc string rather than using tooltip since as V4n1st said python doc string tends to be very large and doesn't fit well with vscode's builtin tooltip?

@luabud luabud changed the title Docstring Tooltip Truncation Issue in Function Name Input Docstrings are truncated even when expanding pop-up window to maximum size Apr 30, 2024
@luabud luabud changed the title Docstrings are truncated even when expanding pop-up window to maximum size Docstrings are truncated even when expanding completion pop-up window to maximum size Apr 30, 2024
@luabud
Copy link
Member

luabud commented Apr 30, 2024

Hmm given the problem is when the code is being typed (i.e. the docstrings that shows when accessing the completion member in the widget), I think having a separate view makes a bit less sense since it feels disruptive to typing?
image

I'll transfer this to VS Code under this thinking

@luabud luabud transferred this issue from microsoft/pylance-release Apr 30, 2024
@jrieken
Copy link
Member

jrieken commented May 2, 2024

@luabud @heejaechang Sorry, but how to I reproduce this? I have python/pylance installed and I am using the file above but I don't get completions

Screenshot 2024-05-02 at 10 27 13

@jrieken
Copy link
Member

jrieken commented May 2, 2024

Also, with a TS sample I do see a scroll bar for the completions details window (it shows on hover like all our scroll bars)

Screenshot 2024-05-02 at 10 29 03

@heejaechang
Copy link

image

click { } and make sure you have auto import completions: true (it is off by default)

Recording.2024-05-02.104038.mp4

as you can see there is no scrollbar in tooltip window.

image

hover tooltip window has it.

by the way, this doesnt show any scroll bar as well?

image

@luabud
Copy link
Member

luabud commented May 2, 2024

it shouldn't need auto imports enabled for the example above though, right? I think it's weird that it showed "no suggestions" here. Doing the same thing and hitting Ctrl+space shows the suggestion to me:
image

@jrieken can you make sure Pylance is enabled? You can check if python.languageServer is set to Default or Pylance, as well as any errors in the Python Language Server output channel

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