This PR adds a detailed Configuration.md document that comprehensively explains the Compiler Explorer configuration system. It covers: - Configuration file structure and hierarchical loading - Property types and automatic conversions - List separators and specialized formats - Group inheritance and compiler configuration - Variable substitution mechanisms - Advanced features like remote compilers and property debugging Additionally, it updates all related documentation to reference this central document for configuration details, reducing duplication and ensuring consistency. This document will serve as the foundation for future configuration system improvements by providing clear documentation of the current implementation.
1.7 KiB
Adding a new formatter
-
Add a
etc/config/compiler-explorer.local.propertiesfile (for details on the configuration system, see Configuration.md)-
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>.tsfile using the template below, replacingTypeandtypeas appropriateimport {UnprocessedExecResult} from '../../types/execution/execution.interfaces'; import {BaseFormatter} from './base'; import {FormatOptions} from './base.interfaces'; 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: string, options: FormatOptions): Promise<UnprocessedExecResult>andisValidStyle(style: string): booleanas 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.tsin 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