mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:34:29 -05:00
throw error if setOptions is called but not implemented
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user