File tree 3 files changed +57
-2
lines changed
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 {
933
933
|| nextTokenKind === SyntaxKind . EndOfFileToken ;
934
934
}
935
935
936
+ if (
937
+ nextTokenKind === SyntaxKind . SemicolonToken &&
938
+ context . currentTokenSpan . kind === SyntaxKind . SemicolonToken
939
+ ) {
940
+ return true ;
941
+ }
942
+
936
943
if (
937
944
nextTokenKind === SyntaxKind . SemicolonClassElement ||
938
945
nextTokenKind === SyntaxKind . SemicolonToken
Original file line number Diff line number Diff line change @@ -51,15 +51,15 @@ class C {
51
51
["p"]
52
52
zero: void
53
53
["one"] = {};
54
- ["two"];
54
+ ["two"]
55
55
;
56
56
}
57
57
a;
58
58
\`b\`
59
59
b;
60
60
(3)
61
61
4;
62
- / regex /;
62
+ / regex /
63
63
;
64
64
[];
65
65
/** 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