diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 01f8113efe1..eea737837e2 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -2290,6 +2290,10 @@ namespace FourSlash { if (this.testType === FourSlashTestType.Server) { (this.languageService as ts.server.SessionClient).setFormattingOptions(this.formatCodeSettings); } + else { + throw Error(`'setFormatOptions' is not implemented for test type ${formatTestType(this.testType)}. +Try setting options via compiler options.`); + } return oldFormatCodeOptions; } @@ -4604,4 +4608,17 @@ namespace FourSlash { }); return emTarget; } + + function formatTestType(testType: FourSlashTestType): string { + switch (testType) { + case FourSlashTestType.Native: + return "Native"; + case FourSlashTestType.Shims: + return "Shims"; + case FourSlashTestType.ShimsWithPreprocess: + return "ShimsWithPreprocess"; + case FourSlashTestType.Server: + return "Server"; + } + } }