Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1 Enhancements/16104.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Automatically indent following `match` and `case` statements. (thanks [Marc Mueller](https://github.com/cdce8p))
4 changes: 3 additions & 1 deletion src/client/language/languageConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export function getLanguageConfiguration(): LanguageConfiguration {
elif |
while |
with |
async \\s+ with
async \\s+ with |
match |
case
)
\\b .*
) |
Expand Down
12 changes: 12 additions & 0 deletions src/test/language/languageConfiguration.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const INDENT_ON_ENTER = [
/^if\b/,
/^elif\b/,
/^else\b/,
/^match\b/,
/^case\b/,
];
const DEDENT_ON_ENTER = [
// block-ending statements
Expand Down Expand Up @@ -180,6 +182,16 @@ suite('Language Configuration', () => {
'except TestError:',
'except :',
'finally:',
'match item:',
'case 200:',
'case (1, 1):',
'case Point(x=0, y=0):',
'case [Point(0, 0)]:',
'case Point(x, y) if x == y:',
'case (Point(x1, y1), Point(x2, y2) as p2):',
'case Color.RED:',
'case 401 | 403 | 404:',
'case _:',
// simple statemenhts
'pass',
'raise Exception(msg)',
Expand Down