Python code navigation in PyCharm vs VSCode

111 views Asked by At

I use VSCode with Python and Pylance extensions. Basic navigation works fine, however when code involves references from function parameters code navigation doesn't work.

For example following scenario works in PyCharm but doesn't work in VSCode. In the code below when I Ctrl+click parent_b_func1 on ins_B.parent_b_func1(A()) it is able to locate the function definition. However when I do Ctrl+click parent_a_func1 on param_a.parent_a_func1() it cannot locate the definition.

class ParentA(object):
    def parent_a_func1(self):
        print("Hi!")


class A(ParentA):
    def a_func1(self):
        pass


class ParentB(object):
    def parent_b_func1(self, param_a):
        param_a.parent_a_func1()
        pass


class B(ParentB):
    def b_func1(self, ):        
        pass


ins_B = B()

ins_B.parent_b_func1(A())

  • VSCode version 1.83.1
  • Python extension version v2023.18.0
  • Pylance extension version v2023.10.50
0

There are 0 answers