prettier-plugin-apex
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
## Unreleased | ||
## 1.0.0-beta.2 | ||
- Fix long static method calls producing undeployable code ([issue](https://github.com/dangmai/prettier-plugin-apex/issues/69)). | ||
## 1.0.0-beta.1 | ||
@@ -4,0 +7,0 @@ - Add support for Anonymous Code block with `--apex-anonymous` option. |
{ | ||
"name": "prettier-plugin-apex", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Salesforce Apex plugin for Prettier", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -291,41 +291,2 @@ /* eslint no-param-reassign: 0 no-underscore-dangle: 0 */ | ||
/** | ||
* jorje sometimes gives us different ASTs depending on the white spaces | ||
* between keywords (#38), which makes it very difficult to know how many | ||
* nested expressions there are in a method call or a variable expression. | ||
* This method is used to calculate that number. | ||
* After this method is called on a node that contains a `dottedExpr`, | ||
* that node will contain a `numberOfDottedExpressions` property. | ||
* @param node the current node being visited. | ||
*/ | ||
function generateDottedExpressionMetadata(node) { | ||
Object.keys(node).forEach(key => { | ||
if (typeof node[key] === "object") { | ||
node[key] = generateDottedExpressionMetadata(node[key]); | ||
} | ||
if (key === "dottedExpr") { | ||
node.numberOfDottedExpressions = 1; | ||
if (node.names) { | ||
node.numberOfDottedExpressions = node.names.length; | ||
} | ||
if (node.dottedExpr && node.dottedExpr.value) { | ||
if (node.dottedExpr.value.numberOfDottedExpressions) { | ||
node.numberOfDottedExpressions += | ||
node.dottedExpr.value.numberOfDottedExpressions; | ||
} else if ( | ||
node.dottedExpr.value["@class"] === apexTypes.ARRAY_EXPRESSION && | ||
node.dottedExpr.value.expr.numberOfDottedExpressions | ||
) { | ||
node.numberOfDottedExpressions += | ||
node.dottedExpr.value.expr.numberOfDottedExpressions; | ||
} else { | ||
node.numberOfDottedExpressions += 1; | ||
} | ||
} | ||
} | ||
}); | ||
return node; | ||
} | ||
// For each node, the jorje compiler gives us its line and its index within | ||
@@ -434,3 +395,2 @@ // that line; however we use this method to resolve that line index to a global | ||
ast = resolveLineIndexes(ast, lineIndexes); | ||
ast = generateDottedExpressionMetadata(ast); | ||
@@ -437,0 +397,0 @@ generateExtraMetadata(ast, getEmptyLineLocations(sourceCode), true); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11851491
4022