* The Grand Reformat - everything made prettier...literally - some tweaks to include a few more files, including documentation - minor changes to format style - some tiny `// prettier-ignore` changes to keep a few things the way we like them - a couple of super minor tweaks to embedded document types to ensure they format correctly
1.4 KiB
Adding a new formatter
-
Add a
etc/config/compiler-explorer.local.propertiesfile-
Add a new formatter under the
formatterskey -
The new formatter can have the following keys: name, exe, styles, type, explicitVersion (to override version parsing), version (argument to get version info), versionRe (regex to filter out the right version info)
-
Add a
lib/formatters/<formatter>.jsfile using the template below, replacingTypeandtypeas appropriateimport {BaseFormatter} from '../base-formatter'; export class TypeFormatter extends BaseFormatter { static get key() { return 'type'; } } -
The value returned by
keyabove corresponds to thetypeproperty you set in the compiler-explorer properties configuration file. -
Tweak
format(source, options)andisValidStyle(style)as necessary. See the JSDoc forformatand the implementations for other formatters to get a further understanding of how to implementformat(source, options).
-
-
Add your
TypeFormattertolib/formatters/_all.jsin alphabetical order -
You can check the output of http://localhost:10240/api/formats to be sure your formatter is there.
-
Make an installer in the infra repository. An example patch for adding an installer can be found here