Skip to content

Commit 686fd1e

Browse files
committed
Fix whitespace around inserted static property
Fixes microsoft#18743
1 parent d03d237 commit 686fd1e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/services/codefixes/fixAddMissingMember.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace ts.codefix {
9292
classDeclarationSourceFile,
9393
classDeclaration,
9494
staticInitialization,
95-
{ suffix: context.newLineCharacter });
95+
{ prefix: context.newLineCharacter, suffix: context.newLineCharacter });
9696
const initializeStaticAction = {
9797
description: formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Initialize_static_property_0), [tokenName]),
9898
changes: staticInitializationChangeTracker.getChanges()

tests/cases/fourslash/codeFixAddMissingMember5.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
verify.codeFix({
1414
description: "Initialize static property 'foo'.",
1515
index: 0,
16-
// TODO: GH#18743 and GH#18445
16+
// TODO: GH#18445
1717
newFileContent: `class C {
1818
static method() {
1919
()=>{ this.foo === 10 };
2020
}
21-
}C.foo = undefined;\r
21+
}\r
22+
C.foo = undefined;\r
2223
`
2324
});

tests/cases/fourslash/codeFixAddMissingMember7.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
verify.codeFix({
1212
description: "Initialize static property 'foo'.",
1313
index: 2,
14-
// TODO: GH#18743 and GH#18445
14+
// TODO: GH#18445
1515
newFileContent: `class C {
1616
static p = ()=>{ this.foo === 10 };
17-
}C.foo = undefined;\r
17+
}\r
18+
C.foo = undefined;\r
1819
`
1920
});

0 commit comments

Comments
 (0)