File tree Expand file tree Collapse file tree 3 files changed +57
-2
lines changed
Expand file tree Collapse file tree 3 files changed +57
-2
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,13 @@ function isSemicolonDeletionContext(context: FormattingContext): boolean {
933933 || nextTokenKind === SyntaxKind . EndOfFileToken ;
934934 }
935935
936+ if (
937+ nextTokenKind === SyntaxKind . SemicolonToken &&
938+ context . currentTokenSpan . kind === SyntaxKind . SemicolonToken
939+ ) {
940+ return true ;
941+ }
942+
936943 if (
937944 nextTokenKind === SyntaxKind . SemicolonClassElement ||
938945 nextTokenKind === SyntaxKind . SemicolonToken
Original file line number Diff line number Diff line change @@ -51,15 +51,15 @@ class C {
5151 ["p"]
5252 zero: void
5353 ["one"] = {};
54- ["two"];
54+ ["two"]
5555 ;
5656}
5757a;
5858\`b\`
5959b;
6060(3)
61614;
62- / regex /;
62+ / regex /
6363;
6464[];
6565/** blah */[0]
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts" />
2+
3+ ////declare const opt: number | undefined;
4+ ////
5+ ////const a = 1;
6+ ////const b = 2;
7+ ////;[1, 2, 3]
8+ ////
9+ ////const c = opt ? 1 : 2;
10+ ////const d = opt ? 1 : 2;
11+ ////;[1, 2, 3]
12+ ////
13+ ////const e = opt ?? 1;
14+ ////const f = opt ?? 1;
15+ ////;[1, 2, 3]
16+ ////
17+ ////type a = 1;
18+ ////type b = 2;
19+ ////;[1, 2, 3]
20+ ////
21+ ////type c = typeof opt extends 1 ? 1 : 2;
22+ ////type d = typeof opt extends 1 ? 1 : 2;
23+ ////;[1, 2, 3]
24+
25+ format . setFormatOptions ( { ...format . copyFormatOptions ( ) , semicolons : ts . SemicolonPreference . Remove } ) ;
26+ format . document ( ) ;
27+ verify . currentFileContentIs (
28+ `declare const opt: number | undefined
29+
30+ const a = 1
31+ const b = 2
32+ ;[1, 2, 3]
33+
34+ const c = opt ? 1 : 2
35+ const d = opt ? 1 : 2
36+ ;[1, 2, 3]
37+
38+ const e = opt ?? 1
39+ const f = opt ?? 1
40+ ;[1, 2, 3]
41+
42+ type a = 1
43+ type b = 2
44+ ;[1, 2, 3]
45+
46+ type c = typeof opt extends 1 ? 1 : 2
47+ type d = typeof opt extends 1 ? 1 : 2
48+ ;[1, 2, 3]` ) ;
You can’t perform that action at this time.
0 commit comments