UNPKG

prettier-plugin-apex

Version:

Salesforce Apex plugin for Prettier

57 lines (56 loc) 2.28 kB
import { AstPath } from "prettier"; import * as jorje from "../vendor/apex-ast-serializer/typings/jorje.d.js"; import { APEX_TYPES } from "./constants.js"; export type SerializedAst = { [APEX_TYPES.PARSER_OUTPUT]: jorje.ParserOutput; comments: jorje.HiddenToken[]; }; export type GenericComment = jorje.HiddenToken; type AstNode = { "@class": string; "@id": string; }; type ReferenceNode = { "@reference": string; }; export type Node = AstNode | ReferenceNode; export type AnnotatedAstNode = AstNode & { trailingEmptyLine?: boolean; }; export type AnnotatedComment = AnnotatedAstNode & GenericComment & { trailing?: boolean; leading?: boolean; printed?: boolean; enclosingNode?: any; followingNode?: any; precedingNode?: any; placement: string; }; export declare function isBinaryish(node: jorje.Expr): boolean; /** * Check if this comment is an ApexDoc-style comment. * This code is straight from prettier JSDoc detection. * @param comment the comment to check. */ export declare function isApexDocComment(comment: jorje.BlockComment): boolean; export declare function checkIfParentIsDottedExpression(path: AstPath): boolean; /** * Massaging the AST node so that it can be compared. This gets called by * Prettier's internal code * @param ast the Abstract Syntax Tree to compare * @param newObj the newly created object */ export declare function massageAstNode(ast: any, newObj: any): any; /** * Helper function to find a character in a string, starting at an index. * It will ignore characters that are part of comments. */ export declare function findNextUncommentedCharacter(sourceCode: string, character: string, fromIndex: number, commentNodes: GenericComment[], backwards?: boolean): number; export declare function getParentType(type: string): string | undefined; export declare function getPrecedence(op: string): number; export declare function doesFileExist(file: string): Promise<boolean>; export declare function getSerializerBinDirectory(): Promise<string>; export declare const NATIVE_PACKAGES: Record<string, string>; export declare function getNativeExecutableNameForPlatform(fullPlatform: string): string; export declare function getNativeExecutableWithFallback(): Promise<string>; export {};