Find where a Python symbol (function, class, variable, etc.) is defined. This provides the “Go to Definition” functionality that lets you navigate to the source code of any symbol.
# In views.py, line 42:result = calculate_total(items)# ^^^^^^^^^^^^^^# Get definition → Goes to utils.py where calculate_total is defined# Result:# file:///workspace/app/utils.py, line 8# def calculate_total(items: List[Item]) -> float:
# In views.py:user = User(name="John", email="john@example.com")# ^^^^# Get definition → Goes to models.py# Result:# file:///workspace/app/models.py, line 25# class User(BaseModel):
# In views.py:from app.utils import calculate_total# ^^^^^^^^^^^^^^# Get definition → Goes to utils.py# Result:# file:///workspace/app/utils.py, line 8
# In functions.py:total = calculate_total(items)# ... many lines later ...print(total) # Where was total defined?# ^^^^^# Get definition → Goes back to where total was assigned