Files
oak-gpui/crates/languages/src/python/indents.scm
T
Smit Barmase 0079c99c2c editor: Add python indentation tests (#30902)
This PR add tests for a recent PR: [language: Fix indent suggestions for
significant indented languages like
Python](https://github.com/zed-industries/zed/pull/29625)

It also covers cases from past related issues so that we don't end up
circling back to them on future fixes.

- [Python incorrect auto-indentation for
except:](https://github.com/zed-industries/zed/issues/10832)
- [Python for/while...else indention overridden by if statement
](https://github.com/zed-industries/zed/issues/30795)
- [Python: erroneous indent on newline when comment ends in
:](https://github.com/zed-industries/zed/issues/25416)
- [Newline in Python file does not indent
](https://github.com/zed-industries/zed/issues/16288)
- [Tab Indentation works incorrectly when there are multiple
cursors](https://github.com/zed-industries/zed/issues/26157)

Release Notes:

- N/A
2025-05-18 07:29:25 +05:30

72 lines
894 B
Scheme

(_ "[" "]" @end) @indent
(_ "{" "}" @end) @indent
(function_definition
":" @start
body: (block) @indent
)
(if_statement
":" @start
consequence: (block) @indent
alternative: (_)? @outdent
)
(else_clause
":" @start
body: (block) @indent
)
(elif_clause
":" @start
consequence: (block) @indent
)
(for_statement
":" @start
body: (block) @indent
)
(with_statement
":" @start
body: (block) @indent
)
(while_statement
":" @start
body: (block) @indent
)
(match_statement
":" @start
body: (block) @indent
)
(class_definition
":" @start
body: (block) @indent
)
(case_clause
":" @start
consequence: (block) @indent
)
(try_statement
":" @start
body: (block) @indent
(except_clause)? @outdent
(else_clause)? @outdent
(finally_clause)? @outdent
)
(except_clause
":" @start
(block) @indent
)
(finally_clause
":" @start
(block) @indent
)