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

IDLE: Restore or keep calltip when needed #86405

Open
terryjreedy opened this issue Nov 2, 2020 · 3 comments
Open

IDLE: Restore or keep calltip when needed #86405

terryjreedy opened this issue Nov 2, 2020 · 3 comments
Assignees
Labels
3.10 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 42239
Nosy @terryjreedy, @taleinat
PRs
  • gh-86405: IDLE - Add tests for calltip #23098
  • gh-86405: IDLE - re-open calltips when closing internal parens #23100
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = None
    created_at = <Date 2020-11-02.05:24:17.048>
    labels = ['expert-IDLE', 'type-bug', '3.10']
    title = 'IDLE: Restore or keep calltip when needed'
    updated_at = <Date 2020-11-02.07:52:09.289>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2020-11-02.07:52:09.289>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2020-11-02.05:24:17.048>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42239
    keywords = ['patch']
    message_count = 3.0
    messages = ['380180', '380190', '380191']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'taleinat']
    pr_nums = ['23098', '23100']
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue42239'
    versions = ['Python 3.10']

    @terryjreedy
    Copy link
    Member Author

    If one types 'int(' an int calltip is displayed. If one adds 'float(' then the float calltip is displayed instead. If one adds '"3.1")', the int calltip is restored. (Actually a new int calltip.) Finally, if one closes with ')', the int calltip is removed.

    If, after 'int(', one adds instead 'f(', where f has no accessible signature or docstring and hence no calltip, the int calltip is dropped with no replacement. When f is closed, the int calltip is not restored because open_calltip in

        def refresh_calltip_event(self, event):  # Bound to ')'.
            if self.active_calltip and self.active_calltip.tipwindow:
                self.open_calltip(False)

    is not called because there is no existing calltip.

    This issue is about somehow having the int calltip after the f call. Possibilities.

    1. Do not drop the int calltip when an inner call has none.

    2. Give the inner call a fake calltip, something like "f(<unknown>". Again, revise open_calltip.

    3. Drop the outer calltip and set a 'nested_call flag in open_calltip and test it with 'or' in refresh_calltip_event (and unset the flag -- conditionally?) to restore it.

    4. Add a calltip stack and test it for not empty in refresh_calltip_event.

    Tal, any opinions on the desired behavior. I believe the bpo-40511 revision should make any of the above, with 1 and 2 being easiest and safest. A problem with 3 and 4 is that the text cursor can be moved out of the call and the calltip closed without the call being completed with ')'.

    I want to add more tests first.

    @terryjreedy terryjreedy added the 3.10 only security fixes label Nov 2, 2020
    @terryjreedy terryjreedy self-assigned this Nov 2, 2020
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error 3.10 only security fixes labels Nov 2, 2020
    @terryjreedy terryjreedy self-assigned this Nov 2, 2020
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels Nov 2, 2020
    @terryjreedy terryjreedy changed the title IDLE: Restore calltip when needed IDLE: Restore or keep calltip when needed Nov 2, 2020
    @terryjreedy terryjreedy changed the title IDLE: Restore calltip when needed IDLE: Restore or keep calltip when needed Nov 2, 2020
    @taleinat
    Copy link
    Contributor

    taleinat commented Nov 2, 2020

    We already have a "<<refresh-calltip>>" virtual event which is triggered upon typing a closing parenthesis ')'. We could just have it always call "open_calltip()" rather than only doing so when one is already open.

    See PR #67289.

    @terryjreedy
    Copy link
    Member Author

    I dislike the idea of creating a Hyperparser and calling get_surrounding_brackets on every ). For (, the open is the ( just typed and the close is typically the newline to the right. For ), the open may be several lines back. I will test for noticeable delay after sleeping.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    Status: In Progress
    Development

    No branches or pull requests

    2 participants