Files
openide/python/testData/psi/PatternMatchingLeadingAndTrailingComments.txt
Mikhail Golubev 98d196aec6 PY-48009 Add automatic indent inside match statements
Namely, for their case clauses and inner comments.

Right now, each of them is indented on its own, as a separate formatting block.
It's still not entirely clear whether we should have a dedicated indented
container element for case clauses, similar to PyStatementList for statements.
It might simplify the formatter and some editing actions, but cause confusion
between the two container elements.

GitOrigin-RevId: 69184d2f8f78e2e113e8f40a310bb13ac0b5e71a
2021-05-24 10:28:35 +00:00

27 lines
982 B
Plaintext

PyFile:PatternMatchingLeadingAndTrailingComments.py
PyMatchStatement
PsiElement(Py:MATCH_KEYWORD)('match')
PsiWhiteSpace(' ')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PsiComment(Py:END_OF_LINE_COMMENT)('# match leading comment')
PsiWhiteSpace('\n ')
PyCaseClause
PsiElement(Py:CASE_KEYWORD)('case')
PsiWhiteSpace(' ')
PyLiteralPattern
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('1')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyPassStatement
PsiElement(Py:PASS_KEYWORD)('pass')
PsiWhiteSpace('\n ')
PsiComment(Py:END_OF_LINE_COMMENT)('# case trailing comment')
PsiWhiteSpace('\n ')
PsiComment(Py:END_OF_LINE_COMMENT)('# match trailing comment')
PsiWhiteSpace('\n')
PsiComment(Py:END_OF_LINE_COMMENT)('# unrelated comment')