microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 767 forks source link

Go to def doesnt go to user-defined class #6086

Open KacieKK opened 3 months ago

KacieKK commented 3 months ago

Environment data

Code Snippet

class ClassWithMagicMethod:
    def __len__(self) -> int:
        return 1

print(len(ClassWithMagicMethod()))

Repro Steps

Animation

1.on len , issue go to def

Expected behavior

go to line

    def __len__(self) -> int:

Actual behavior

It went to .pyi file

debonte commented 3 months ago

Seems like an offset related bug? It repros if the cursor is immediately after len as in the repro video. But it does not repro if the cursor is immediately before len, between the l and e, or between the e and n.

KacieKK commented 3 months ago

Seems like an offset related bug? It repros if the cursor is immediately after len as in the repro video. But it does not repro if the cursor is immediately before len, between the l and e, or between the e and n.

yes, it exactly behaves like this

debonte commented 3 months ago

Not a recent regression. Repros on 2024.2.1.