Recognise async def method headers in worder - #859
Open
gadievron wants to merge 1 commit into
Open
Conversation
gadievron
force-pushed
the
fix/worder-async-def
branch
from
August 16, 2026 17:53
e9c8570 to
d70366e
Compare
The predicate only matched the canonical `def`/`class` prefixes, so an `async def` method header was not treated as a definition: find_definition on a call via self resolved to the call site instead of the def, and Rename mis-handled it. Normalize the whitespace run before comparing so `async def`, `async def` and `async\tdef` are all recognised. Version independent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gadievron
force-pushed
the
fix/worder-async-def
branch
from
August 16, 2026 19:18
d70366e to
93082f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
worder'sis_a_class_or_function_name_in_headeronly recognised thedefandclassheader prefixes, so anasync defmethod header was not treated as adefinition. As a result
find_definitionfor anasync defmethod called viaselfresolved to the call site instead of the def, andRenamefrom thecall did not reach the def.
Module-level
async defalready resolved correctly (different path); only methodresolution via
selfwas affected.Fix
Add
"async def"to the recognised headers and normalise internal whitespace soasync def/async\tdef/ line-continued forms also match:The predicate reads the blanked
real_code, so string/comment text can't spoofit, and only those three exact strings match — no false-positive surface. The fix
is version-independent (
async defhas been valid since Python 3.5).Tests cover
find_definitionon an async method (canonical and tab/extra-spacespellings), an end-to-end
Rename, and two regression controls (sync methods andmodule-level async defs still resolve).
Checklist