diff --git a/internal/format/rules.go b/internal/format/rules.go index 2d80fea624c..343de805a1b 100644 --- a/internal/format/rules.go +++ b/internal/format/rules.go @@ -216,6 +216,7 @@ func getAllRules() []ruleSpec { ast.KindInterfaceKeyword, ast.KindModuleKeyword, ast.KindNamespaceKeyword, + ast.KindOverrideKeyword, ast.KindPrivateKeyword, ast.KindPublicKeyword, ast.KindProtectedKeyword, diff --git a/internal/fourslash/tests/formattingOverrideKeyword_test.go b/internal/fourslash/tests/formattingOverrideKeyword_test.go new file mode 100644 index 00000000000..b50d1943a14 --- /dev/null +++ b/internal/fourslash/tests/formattingOverrideKeyword_test.go @@ -0,0 +1,21 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/fourslash" + "github.com/microsoft/typescript-go/internal/testutil" +) + +func TestFormattingOverrideKeyword(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `class MyClass { + override myMethod() { };/*1*/ +}` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.FormatDocument(t, "") + f.GoToMarker(t, "1") + f.VerifyCurrentLineContent(t, ` override myMethod() { };`) +}