Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Python async function motions with async def #9511

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nathan-gage
Copy link

@nathan-gage nathan-gage commented Mar 3, 2025

What this PR does / why we need it:
fixes Python function motions [m and ]m to recognize async def

Which issue(s) this PR fixes
fixes #9510

Additional notes
i opted to keep old tests and introduce new.

in this process, i found a bug related to function boundaries, captured in "valid findPrevFunctionStart, from inner regular to outer async" and "valid findPrevFunctionStart, from inner async to inner regular".

The bug was that when searching backwards for function boundaries, the original code would include the current function in the results because isBefore() returns true for equal positions, causing the motion to incorrectly stay at the current function instead of moving to the previous one. the original tests didn't have any test cases for moving backwards from within a function definition line itself.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

async def breaks Python function motions
1 participant