- Fix native executable not usable in NixOS Linux environment (issue).
- Fix native executable not spawned correctly in path with special characters (issue).
- Native parsing is now the default parser for supported platforms, with fallback to Java parser for unsupported platforms.
- Support Apex AST Serializer native executable for macOS x64.
- Improve native executable performance by utilizing Profile-Guided Optimization.
- Improve parsing performance by directly serializing object references.
- Improve parsing performance by using one-pass Depth-First Search to enrich AST.
- Apex AST Serializer no longer supports outputting XML, or object references.
This reduces code paths that are not absolutely necessary for the operation of Prettier Apex,
leading to performance increases and binary size reduction.
This should not affect end users' experience with Prettier Apex,
but if you are using Apex AST Serializer directly,
the
-i
and-f
flags have been removed. - The
install-apex-executables
command is removed, since native executables are now distributed as optional dependencies to the main package.
- Fix Windows application not being able to get output from parser when
DEBUG
environment variable is set (issue). - Improving parsing performance - thanks to @lukecotter for their contribution!
- Fix
install-apex-executables
script hanging unnecessarily (issue). - Prettier Apex should now throw an error with details when it fails to call Apex AST Serializer executable.
- NPM package tests are now run on multiple platforms to catch any platform-dependent regressions.
- Use relative path to binary files to avoid issues with special characters in Windows path.
- Spawn Apex AST Serializer server process with shell turned on (missed in
v2.1.2
). Thanks to @mwcm for their contribution!
- Spawn Apex AST Serializer process with shell turned on.
This is a workaround for new version of NodeJS that disallows calling
.bat
file without this option. See this blog post for more details (issue). Thanks to @mwcm for their contribution!
- Native executable location has been moved to be under the
vendor
directory. This should not affect any usage of the library, unless you are referencing this location from a custom script. - Our internal testing structure has changed. Please follow CONTRIBUTING.md to set up your environment again.
- Fix native executable not having generated with enough reflection metadata (issue).
- Add support for Null Coalescing Expression (doc).
- Add experimental support for using native executables to speed up parsing Apex code. Follow the documentation to try it out, and please report any issues you encounter.
- Use
pnpm
for internal dependency management instead ofyarn
. If you forked this repository before this change, make sure to follow CONTRIBUTING.md to set up your environment again. - This repository is now a monorepo (managed by nx), containing all packages related to this project. This change should not affect normal usage of the library, but if you are maintaining a fork of this library, please make sure to update your workflow accordingly.
- Our new Playground has been published, allowing users to try out Prettier Apex without installing anything.
- Allow user to customize the secret used to shut down the parsing server.
- Allow user to specify the protocol (HTTP/HTTPS) that the parsing server uses.
- This is a fix version that includes the correct Production bundle. Please refer to the 2.0.0 changes for actual change notes.
Please follow this guide to upgrade Prettier Apex to this new major version.
- Support Prettier v3 (issue). You cannot use this version with Prettier v2, please plan your upgrade accordingly.
- Drop support for NodeJS < 18.11.0.
- Prettier Apex is now distributed as an ECMAScript Module. This shouldn't affect normal usage of the library, but if you are importing code from Prettier Apex you may need to change your code to adapt.
- Add support for User Mode in Database Operations (issue).
start-apex-server
takes optional-c
flag, which will be passed on toapex-ast-serializer
as a comma-delimited list of allowed origins that will be added to the CORS headers returned by the parsing server.start-apex-server
pipes internal logs to console, so that errors can be caught more quickly by users.
- Fix binaryish expressions having wrong indentation inside parentheses (issue).
- Keep original position for comments in between If-Else blocks and Try-Catch blocks, accordingly fix issue with unprinted comment (issue).
- Use
yarn
for internal dependency management instead ofnpm
. If you forked this repository before this change, make sure to follow CONTRIBUTING.md to set up your environment again. start-apex-server
andstop-apex-server
no longer exports any methods. This should not affect any user functionality, but if you are a developer who's relying on those methods, please importstart
andstop
from http-server instead.
- Drop support for NodeJS < 14.
- Prettier Apex has been converted to Typescript, enabling faster response time to internal jorje changes from Salesforce.
- Breaking: Locations for
start-apex-server.js
andstop-apex-server.js
are changed - they are now in thedist
directory. - Add ability to specify
host
andport
options for built-in parsing server (issue).
- Add support for SOQL Geolocation Expression (issue).
- Fix SOQL Time literals always getting printed in UTC timezone.
- Fix wrong indentations inside long SELECT functions (issue).
- Remove extraneous newline at the end of long GROUP BY and WITH DATA CATEGORY clauses (issue).
- Fix unstable leading comment formatting for ternary expressions (issue).
- Add support for prettier-ignore comments in the middle of IfElseBlock (issue).
- Use user input to improve line break heuristics in short SOQL/SOSL queries (issue).
- Fix unstable leading comments before Block Statement.
- Support trailing
prettier-ignore
comments (issue). - Fix failure to call
apex-ast-serializer
because of excessively long CLASSPATH on Windows (issue). - Fix unstable end of line comments in binaryish expressions.
- Drop support for NodeJS < 12.
- Fix last comment inside New Expression turning into trailing comment (issue).
- Fix prettier-ignore comment getting attached to modifier node instead of surrounding expressions (issue).
- Fix Enum cases using wrong separator in
switch
statements (issue).
- Drop support for Java < 11.
- Add support for Java 16.
- Fix SOQL query string getting quoted incorrectly in LIKE expressions (issue).
- Prefer list init syntax
new Object[0]
in certain situations (issue) - thanks to @brianmfear.
- Remove extraneous indentation and blank line for HAVING clauses (issue).
- Upgrade dependencies to fix security issues.
- Move CI/CD pipeline from Travis to Github Actions.
- Add support for Safe Navigation Operator (doc).
- Always break up TYPEOF SOQL queries (issue).
- Remove extraneous grouping in certain binary-ish expressions (issue).
- Handle new jorje structure for types in enhanced for loops.
- Clearer error message when failing to connect to standalone Apex parser server (issue).
- Handle SOQL Select Distance Expression (issue).
- Use alignment instead of indentation to provide clarity for ternary expressions (issue).
- Use uppercase TRUE, FALSE, NULL in SOQL expressions (issue).
- Fix incorrect formatting of for loop inits without initialization (issue).
- Support Prettier 2.0 (issue).
- NodeJS support limited to version >= 10.13.0 - driven by Prettier 2.0.
- Remove extraneous leading empty line in anonymous code blocks.
- Sync parser name with Visual Studio Code language Id for Anonymous Apex (issue).
- Remove extraneous whitespaces between Enum modifiers (issue).
- Preserve code points from original source code (issue).
- Prettier >= 1.19 is now required to be used with this plugin,
in order to support new option type
string
.
- Add option
apexStandaloneHost
, default tolocalhost
.
- Fix last comment in Annotations being put in wrong location (issue).
- Fix Name Value Parameters using more newlines than necessary (issue).
- Remove
--apex-anonymous
option, useapex-anonymous
parser instead (issue).
- By default, add curly bracket spacing for maps, lists and sets (issue).
- Fix extraneous linebreaks being added after
this
variable expression (issue). - Fix wrong comment position in a long method/variable chain (issue).
- Fix extraneous linebreaks for empty parameter list in long method declarations (issue).
- Fix SOQL query numbers losing negative value (issue).
- Fix method call expressions containing
this
andsuper
having an extra indentation level. - Fix trailing comment wrong location after last element in list/set/map init literals (issue).
- Fix incorrect format for decimals/doubles (issue).
- Add support for Number Expression in SOQL Geolocation Literal (issue).
- Fix duplicated trailing empty lines for multiple expressions on the same line (issue).
- Fix expressions in Name Value Parameters not being indented (issue).
- Fix SOQL queries in binaryish expressions having extraneous indentations (issue).
- Fix SOQL query number being printed as different types (
big-decimal
toint
) in certain situations.
- CLI/Option change:
- Add
apex-insert-final-newline
option (issue).
- Add
- Remove newline before SOQL expression in ForInit (issue).
- Add space before colon in ForEnhancedControl (issue).
- Add support for AnnotationString (issue).
- Update dependency requirement for Prettier.
- Fix incorrect format for SOQL query with multiple types in FROM clause (issue).
- Fix incorrect order of expressions in SOSL query (issue).
- Add support for class and interface generics (issue).
- Remove references to deleted vendor file
apex-ast-serializer-ng
.
- CLI/Option change:
- Remove
apex-verify-ast
option. Please use--debug-check
instead.
- Remove
- Implement comments using Prettier's API.
- Add support for
prettier-ignore
directive (issue). - Add support for
--require-pragma
and--insert-pragma
CLI directives. - Use internal HTTP server instead of Nailgun for built in parser.
- Fix unstable comments in between If/Else blocks.
- Fix unstable comments in between Try/Catch/Finally blocks.
- Fix unstable comments in WhereCompoundExpr.
- Fix unstable comments for NestedExpr.
- Fix unstable formatting for Method Declaration with no body.
- Fix unstable comments for Annotations.
- Fix unstable leading comments to ValueWhen and ElseWhen blocks.
- Throw errors when encountering unknown node types.
- Fix long static method calls producing undeployable code (issue).
- Add support for Anonymous Code block with
--apex-anonymous
option. - CLI/Option change:
use-standalone-server
option is nowapex-standalone-parser
, and it is now a choice betweennone
andbuilt-in
.server-port
option is nowapex-standalone-port
.- Add
apex-verify-ast
option.
- Fix dangling comments being printed incorrectly for Triggers (issue). Thanks to @praksb, @ntotten and @vazexqi for their help on getting jorje fixed.
- Fix SOQL unary expression not generating space before next expression.
- Add support for SOQL WHERE Calculation Expression (issue).
- Add support for parameter modifiers (issue).
- Add support for
while
loop without body (issue). - Add support for
for
loop without body (issue). - Add support for Java expressions/typerefs (issue).
- Fix Package Version Expression.
- Fix Unicode characters being printed incorrectly (issue).
- Workaround for certain cases of AST verification failing (issue).
- Fix overlapping node with comment when comment contains special characters.
- Fix awkward breaks for long method call chain (issue),
- Remove breaks in Map types (issue).
- Fix binary/boolean expressions breaking after operation despite available space (issue).
- Fix leading comment to SOQL inner query being misindentified as trailing comment to previous column clause (issue).
- Fix awkward breaks for multiline binaryish expressions (issue).
- Fix formatting for Apex types containing expressions but do not add groups and/or breaks.
- Fix SOQL/SOSL boolean expressions having extra parentheses (issue).
- Fix ternary expressions not breaking correctly (issue).
- Fix comments not being indented in binaryish expressions (issue).
- Fix array index indentation surrounding variable expressions and method call expressions.
- Fix unstable IfBlock trailing comments.
- Fix unstable NameValueParameter trailing comments.
- Fix unstable WhereOpExpr trailing comments.
- Fix trailing comments after class names not being printed (issue).
- Add new lines in empty blocks for Enum.
- Add new lines to long list of annotation parameters.
- Add new lines to long list of method declaration parameters.
- Add new line after last usage parameter in long list for triggers.
- Add new lines to long list of conditions in loops.
- Fix missing alias in FROM expression (issue).
- Fix double quotes being escaped unnecessarily (issue).
- Fix inline comments in blocks being attached to wrong node (issue).
- Fix comments being pushed to next lines because of node's trailing empty line (issue).
- Fix comments not being printed if they appear before the root node (issue).
- Fix dangling comments not being printed for Class, Interface, Enum and Block Statement (issue).
- Add new lines in empty blocks (issue).
- Fix trailing comment being mistaken as leading comment in certain situations,
because
jorje
provides wrong start and end indexes for some node types (issue).
- Fix Annotated Declaration being indented too far (issue).
- Getter and setter will no longer break if they can fit on the same line.
- Add documentation for configuration options.
- Fix formatting for trailing comments at the end of block statements (issue).
- Fix issue in which comments right before semi colon are not printed (issue).
- Assert that all comments have been printed out in the formatted code.
- Fix long expressions not breaking into multi lines (issue).
- Fix
apex-ast-serializer
executables not having their execute bits set on *nix (issue).
- Support
WITH SECURITY_ENFORCED
in SOQL (issue). - Fix
npm scripts
pointing to old files.
- Fix DML operation having double indents (issue).
- Rename scripts to start and stop Apex Parser Server.
- Use Prettier's default options for
tabWidth
andprintWidth
. - Invoke
apex-ast-serializer
directly by default, with option to use Nailgun server.
- Initial release.