prettier-plugin-pegjs
Version:
A Prettier plugin for formatting Pegjs and Peggy-js grammars
25 lines (24 loc) • 967 B
TypeScript
import type { Printer } from "prettier";
import { AstNode } from "../types";
type PrinterPrint = Printer<AstNode | null | undefined>["print"];
type PrinterEmbed = NonNullable<Printer<AstNode>["embed"]>;
type PrinterComment = NonNullable<Printer<AstNode>["printComment"]>;
export declare const printPegjsAst: PrinterPrint;
/**
* This is called by Prettier whenever a comment is to be printed.
* Comments are stored outside of the AST, but Prettier will make its best guess
* about which node a comment "belongs to". The return Doc of this function
* is inserted in the appropriate place.
*
* @param {*} commentPath
* @param {*} options
*/
export declare const printComment: PrinterComment;
/**
* Used to print embedded javascript codeblocks. This function
* is called on every node. If `null` is returned, the Pegjs
* printer is used. Otherwise, `textToDoc` can be used to select a
* different one.
*/
export declare const embed: PrinterEmbed;
export {};