Skip to content

Fixes indented block position by PositionProvider (#1380)#1381

Open
AryazE wants to merge 4 commits intoInstagram:mainfrom
AryazE:main
Open

Fixes indented block position by PositionProvider (#1380)#1381
AryazE wants to merge 4 commits intoInstagram:mainfrom
AryazE:main

Conversation

@AryazE
Copy link
Copy Markdown

@AryazE AryazE commented Jul 17, 2025

Summary

Added a check for ClassDef and FunctionDef nodes with decorators when they appear as the first node in an indented block.
In such cases, the state.record_syntactic_position is called with start_node being the first decorator of the class/function definition and not the definition itself.

Test Plan

Added two tests, one for ClassDef and one for FunctionDef in libcst/metadata/tests/test_position_provider.py under PositionProviderTest

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant