donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
289 stars 57 forks source link

Failure with long function signature #601

Closed donkirkby closed 3 months ago

donkirkby commented 4 months ago

What I did

I wrote a function with a return value type hint, and then called a different function.

import typing

def bar(x):
    return x * 2

def nok() -> typing.Tuple[
        int]:
    pass

print(bar(42))

What happened

When I ran it with space_tracer, the display was blank.

> space_tracer example.py 
import typing              |
                           |
                           |
def bar(x):                |
    return x * 2           |
                           |
                           |
def nok() -> typing.Tuple[ |
        int]:              |
    pass                   |
                           |
                           |
print(bar(42))             |

If I made the function name one character shorter, then the display looks normal.

> space_tracer example.py 
import typing             |
                          |
                          |
def bar(x):               | x = 42
    return x * 2          | return 84
                          |
                          |
def ok() -> typing.Tuple[ |
        int]:             |
    pass                  |
                          |
                          |
print(bar(42))            | print('84')

Switching the signature to fit on one line also fixes it.

What I wanted to happen

Both versions should display fine.

My environment