Skip to content

Commit 030a9c6

Browse files
Merge pull request SublimeText#180 from SublimeText/indent_else
Fix else indentation Fixes SublimeText#107
2 parents eb639ba + 353a083 commit 030a9c6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Indentation.tmPreferences

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<dict>
1111
<key>unIndentedLinePattern</key>
1212
<string>"@</string>
13+
<key>decreaseIndentPattern</key>
14+
<string>^(.*\*/)?\s*\}[;\s]*(?:$|else\b|elseif\b)</string>
1315
</dict>
1416
</dict>
1517
</plist>

Tests/syntax_test_PowerShell.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ function Some.other.function{}
869869
FUNCTION MyFunction2 {}
870870
# <- storage.type
871871
# ^^^^^^^^^^^ entity.name.function
872-
# @@@@@@@@@@ definition
872+
# @@@@@@@@@@@ definition
873873
# ^ punctuation.section.braces.begin
874874
# ^ punctuation.section.braces.end
875875
function New-File { }

Tests/syntax_test_reindent.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ Function Get-ForegroundWindow {
1111
}
1212

1313
Get-ForegroundWindow
14+
15+
if ($true) {
16+
Write-Host 'test'
17+
} elseif ($false) {
18+
Write-Host 'test2'
19+
} else {
20+
Write-Host 'test3'
21+
}

0 commit comments

Comments
 (0)