@flowscripter/dynamic-cli-framework
    Preparing search index...

    Interface PrettyPrinterService

    Service providing syntax based pretty printing of text for the CLI using prettier.

    interface PrettyPrinterService {
        getRegisteredSyntaxes(): Promise<readonly string[]>;
        prettify(text: string, syntaxName: string): Promise<string>;
        registerSyntax(
            syntaxName: string,
            syntaxDefinition: Plugin<unknown>,
        ): Promise<void>;
    }

    Implemented by

    Index
    • Return the names of the currently registered syntaxes.

      Returns Promise<readonly string[]>

    • Return a pretty printed version of the provided text using the specified syntax.

      Parameters

      • text: string

        the text to prettify.

      • syntaxName: string

        the syntax to use.

      Returns Promise<string>

    • Register a new syntax.

      The recommended way to define a new language syntax plugin is to follow the instructions here:

      https://prettier.io/docs/plugins#developing-plugins

      There is a list of already defined languages available for import here:

      Parameters

      • syntaxName: string

        the name used to refer to the syntax.

      • syntaxDefinition: Plugin<unknown>

        the definition for the syntax conforming to the Prettier plugin interface.

      Returns Promise<void>