prettier-plugin-apex
Version:
Salesforce Apex plugin for Prettier
70 lines (69 loc) • 3.23 kB
TypeScript
import type { AstPath, Doc, ParserOptions } from "prettier";
import { AnnotatedComment, GenericComment } from "./util.js";
export declare function isPrettierIgnore(comment: AnnotatedComment): boolean;
export declare function printComment(path: AstPath): Doc;
export declare function printDanglingComment(commentPath: AstPath, options: ParserOptions): Doc;
/**
* This is called by Prettier's comment handling code, in order for Prettier
* to tell if this is a node to which a comment can be attached.
*
* @param node The current node
* @returns {boolean} whether a comment can be attached to this node or not.
*/
export declare function canAttachComment(node: any): boolean;
/**
* This is called by Prettier's comment handling code, in order to find out
* if this is a block comment.
*
* @param comment The current comment node.
* @returns {boolean} whether it is a block comment.
*/
export declare function isBlockComment(comment: GenericComment): boolean;
/**
* This is called by Prettier's comment handling code.
* We can use this to tell Prettier that we will print comments manually on
* certain nodes.
* @returns {boolean} whether or not we will print the comment on this node manually.
*/
export declare function willPrintOwnComments(path: AstPath): boolean;
export declare function getTrailingComments(node: any): AnnotatedComment[];
/**
* This is called by Prettier's comment handling code, in order to handle
* comments that are on their own line.
*
* @param comment The comment node.
* @param sourceCode The entire source code.
* @returns {boolean} Whether we have manually attached this comment to some AST
* node. If `true` is returned, Prettier will no longer try to attach this
* comment based on its internal heuristic.
*/
export declare function handleOwnLineComment(comment: AnnotatedComment, sourceCode: string): boolean;
/**
* This is called by Prettier's comment handling code, in order to handle
* comments that have preceding text but no trailing text on a line.
*
* @param comment The comment node.
* @param sourceCode The entire source code.
* @returns {boolean} Whether we have manually attached this comment to some AST
* node. If `true` is returned, Prettier will no longer try to attach this
* comment based on its internal heuristic.
*/
export declare function handleEndOfLineComment(comment: AnnotatedComment, sourceCode: string): boolean;
/**
* This is called by Prettier's comment handling code, in order to handle
* comments that have both preceding text and trailing text on a line.
*
* @param comment The comment node.
* @param sourceCode The entire source code.
* @returns {boolean} Whether we have manually attached this comment to some AST
* node. If `true` is returned, Prettier will no longer try to attach this
* comment based on its internal heuristic.
*/
export declare function handleRemainingComment(comment: AnnotatedComment, sourceCode: string): boolean;
/**
* This is called by Prettier's comment handling code, in order to find out
* if a node should be formatted or not.
* @param path The FastPath object.
* @returns {boolean} Whether the path should be formatted.
*/
export declare function hasPrettierIgnore(path: AstPath): boolean;