Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 21fae9f

Browse files
committed
Don't try to indent case or default statements
Using the current regexp-based indentation system, we either have to indent these statements the way that textmate does, which is non-standard, or the way sublime does, which requires the user to manually type tab after a case or default statement. I've chosen sublime's way for now, because it makes it easier to achieve the most common indentation style. Closes #49
1 parent 3028ec9 commit 21fae9f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

settings/language-javascript.cson

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
\\{ [^}"\']* $
77
| \\[ [^\\]"\']* $
88
| \\( [^)"\']* $
9-
| case[\\s\\S]*: $
10-
| default: $
119
'
1210
'decreaseIndentPattern': '(?x)
1311
^ \\s* (\\s* /[*] .* [*]/ \\s*)* [}\\])]

spec/javascript-spec.coffee

+10
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,16 @@ describe "Javascript grammar", ->
357357
}
358358
"""
359359

360+
it "doesn't indent case statements, because it wouldn't know when to outdent", ->
361+
expectPreservedIndentation """
362+
switch (e) {
363+
case 5:
364+
something();
365+
case 6:
366+
somethingElse();
367+
}
368+
"""
369+
360370
it "indents collection literals", ->
361371
expectPreservedIndentation """
362372
[

0 commit comments

Comments
 (0)