From ff49f5579b75086b33061fce6680f88cc30f0860 Mon Sep 17 00:00:00 2001 From: sjonynaite Date: Wed, 21 Aug 2024 17:16:47 +0300 Subject: [PATCH 1/6] Updated findFormattter added tests --- .../find-firstLastNextPrev/input.p | 8 + .../find-firstLastNextPrev/target.p | 8 + .../find-multipleConditions-()/input.p | 6 + .../find-multipleConditions-()/target.p | 6 + .../find-multipleConditions-()2/input.p | 6 + .../find-multipleConditions-()2/target.p | 6 + .../find-multipleConditions/input.p | 8 + .../find-multipleConditions/target.p | 8 + resources/functionalTests/find-spaces/input.p | 5 + .../functionalTests/find-spaces/target.p | 5 + .../functionalTests/find-useIndex/input.p | 5 + .../functionalTests/find-useIndex/target.p | 6 + src/model/SyntaxNodeType.ts | 1 + .../enableFormatterDecorators.ts | 2 + src/v2/formatters/find/FindFormatter.ts | 234 ++++++++++++++++++ src/v2/formatters/find/FindSettings.ts | 8 + 16 files changed, 322 insertions(+) create mode 100644 resources/functionalTests/find-firstLastNextPrev/input.p create mode 100644 resources/functionalTests/find-firstLastNextPrev/target.p create mode 100644 resources/functionalTests/find-multipleConditions-()/input.p create mode 100644 resources/functionalTests/find-multipleConditions-()/target.p create mode 100644 resources/functionalTests/find-multipleConditions-()2/input.p create mode 100644 resources/functionalTests/find-multipleConditions-()2/target.p create mode 100644 resources/functionalTests/find-multipleConditions/input.p create mode 100644 resources/functionalTests/find-multipleConditions/target.p create mode 100644 resources/functionalTests/find-spaces/input.p create mode 100644 resources/functionalTests/find-spaces/target.p create mode 100644 resources/functionalTests/find-useIndex/input.p create mode 100644 resources/functionalTests/find-useIndex/target.p create mode 100644 src/v2/formatters/find/FindFormatter.ts create mode 100644 src/v2/formatters/find/FindSettings.ts diff --git a/resources/functionalTests/find-firstLastNextPrev/input.p b/resources/functionalTests/find-firstLastNextPrev/input.p new file mode 100644 index 0000000..b2b68c7 --- /dev/null +++ b/resources/functionalTests/find-firstLastNextPrev/input.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND FIRST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND LAST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND NEXT Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND PREV Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-firstLastNextPrev/target.p b/resources/functionalTests/find-firstLastNextPrev/target.p new file mode 100644 index 0000000..0b3d193 --- /dev/null +++ b/resources/functionalTests/find-firstLastNextPrev/target.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND FIRST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND LAST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND NEXT Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND PREV Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions-()/input.p b/resources/functionalTests/find-multipleConditions-()/input.p new file mode 100644 index 0000000..46cf014 --- /dev/null +++ b/resources/functionalTests/find-multipleConditions-()/input.p @@ -0,0 +1,6 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE (Customer.CustNum > 50 AND Customer.CustNum < 100) OR + Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions-()/target.p b/resources/functionalTests/find-multipleConditions-()/target.p new file mode 100644 index 0000000..37f2585 --- /dev/null +++ b/resources/functionalTests/find-multipleConditions-()/target.p @@ -0,0 +1,6 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE (Customer.CustNum > 50 AND Customer.CustNum < 100) OR + Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions-()2/input.p b/resources/functionalTests/find-multipleConditions-()2/input.p new file mode 100644 index 0000000..34d84c2 --- /dev/null +++ b/resources/functionalTests/find-multipleConditions-()2/input.p @@ -0,0 +1,6 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Order WHERE (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR +(Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions-()2/target.p b/resources/functionalTests/find-multipleConditions-()2/target.p new file mode 100644 index 0000000..0b14b40 --- /dev/null +++ b/resources/functionalTests/find-multipleConditions-()2/target.p @@ -0,0 +1,6 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Order WHERE (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR + (Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions/input.p b/resources/functionalTests/find-multipleConditions/input.p new file mode 100644 index 0000000..0747c5d --- /dev/null +++ b/resources/functionalTests/find-multipleConditions/input.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE +Customer.CustNum = 5 AND Customer.CustNum = 6 OR + Customer.CustNum = 7 AND + Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find-multipleConditions/target.p b/resources/functionalTests/find-multipleConditions/target.p new file mode 100644 index 0000000..5a116d0 --- /dev/null +++ b/resources/functionalTests/find-multipleConditions/target.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE Customer.CustNum = 5 AND + Customer.CustNum = 6 OR + Customer.CustNum = 7 AND + Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find-spaces/input.p b/resources/functionalTests/find-spaces/input.p new file mode 100644 index 0000000..d70cac2 --- /dev/null +++ b/resources/functionalTests/find-spaces/input.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-spaces/target.p b/resources/functionalTests/find-spaces/target.p new file mode 100644 index 0000000..9996f9e --- /dev/null +++ b/resources/functionalTests/find-spaces/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +FIND Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find-useIndex/input.p b/resources/functionalTests/find-useIndex/input.p new file mode 100644 index 0000000..6a13e2c --- /dev/null +++ b/resources/functionalTests/find-useIndex/input.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +find Order where Order.OrderStatus = "Shipped" and Order.ShipDate = today use-index OrderNum. \ No newline at end of file diff --git a/resources/functionalTests/find-useIndex/target.p b/resources/functionalTests/find-useIndex/target.p new file mode 100644 index 0000000..4fcd22c --- /dev/null +++ b/resources/functionalTests/find-useIndex/target.p @@ -0,0 +1,6 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true, +"abl.completion.upperCase": true}*/ + +find Order where Order.OrderStatus = "Shipped" and + Order.ShipDate = today use-index OrderNum. \ No newline at end of file diff --git a/src/model/SyntaxNodeType.ts b/src/model/SyntaxNodeType.ts index 4ea3d3c..1603a57 100644 --- a/src/model/SyntaxNodeType.ts +++ b/src/model/SyntaxNodeType.ts @@ -54,4 +54,5 @@ export enum SyntaxNodeType { EachKeyword = "EACH", EndKeyword = "END", IfKeyword = "IF", + FindKeyword = "FIND", } diff --git a/src/v2/formatterFramework/enableFormatterDecorators.ts b/src/v2/formatterFramework/enableFormatterDecorators.ts index 4881628..a8e1273 100644 --- a/src/v2/formatterFramework/enableFormatterDecorators.ts +++ b/src/v2/formatterFramework/enableFormatterDecorators.ts @@ -4,6 +4,7 @@ import { IfFormatter } from "../formatters/if/IfFormatter"; import { DefineFormatter } from "../formatters/define/DefineFormatter"; import { UsingFormatter } from "../formatters/using/UsingFormatter"; import { CaseFormatter } from "../formatters/case/CaseFormatter"; +import { FindFormatter } from "../formatters/find/FindFormatter"; // needed just for enabling decorators. Decorators does not work if there is no usage of a class in the reachable code export function enableFormatterDecorators(): void { @@ -13,4 +14,5 @@ export function enableFormatterDecorators(): void { DefineFormatter; UsingFormatter; CaseFormatter; + FindFormatter; } diff --git a/src/v2/formatters/find/FindFormatter.ts b/src/v2/formatters/find/FindFormatter.ts new file mode 100644 index 0000000..7975024 --- /dev/null +++ b/src/v2/formatters/find/FindFormatter.ts @@ -0,0 +1,234 @@ +import { SyntaxNode } from "web-tree-sitter"; +import { IFormatter } from "../../formatterFramework/IFormatter"; +import { SyntaxNodeType } from "../../../model/SyntaxNodeType"; +import { CodeEdit } from "../../model/CodeEdit"; +import { FullText } from "../../model/FullText"; +import { FormatterHelper } from "../../formatterFramework/FormatterHelper"; +import { AFormatter } from "../AFormatter"; +import { RegisterFormatter } from "../../formatterFramework/formatterDecorator"; +import { FindSettings } from "./FindSettings"; +import { IConfigurationManager } from "../../../utils/IConfigurationManager"; + +/** + * Note: The WHERE clause block with multiple LogicalExpressions does not align correctly + * during the first formatting if there are spaces before the WHERE clause. + * + * Question: Should QueryTuning also be formatted in a similar manner to LogicalExpressions, + * with aligned spacing and line breaks? + */ + +@RegisterFormatter +export class FindFormatter extends AFormatter implements IFormatter { + private startColumn = 0; + private findBodyValue = ""; + + public static readonly formatterLabel = "findFormatting"; + private readonly settings: FindSettings; + + public constructor(configurationManager: IConfigurationManager) { + super(configurationManager); + this.settings = new FindSettings(configurationManager); + } + + match(node: Readonly): boolean { + return node.type === SyntaxNodeType.FindStatement; + } + + parse( + node: Readonly, + fullText: Readonly + ): CodeEdit | CodeEdit[] | undefined { + this.collectCaseStructure(node, fullText); + return this.getCodeEdit( + node, + FormatterHelper.getCurrentText(node, fullText), + this.findBodyValue, + fullText + ); + } + + private collectCaseStructure( + node: SyntaxNode, + fullText: Readonly + ) { + this.startColumn = this.getStartColumn(node); + this.findBodyValue = this.getFindStatementBlock(node, fullText); + } + + private getFindStatementBlock( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + + node.children.forEach((child) => { + resultString = resultString.concat( + this.getFindExpressionString(child, fullText) + ); + }); + + resultString = resultString.concat("."); + return resultString; + } + + private getFindExpressionString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + + switch (node.type) { + case SyntaxNodeType.FindKeyword: + newString = + " ".repeat(this.startColumn) + + FormatterHelper.getCurrentText(node, fullText).trim(); + break; + case SyntaxNodeType.WhereClause: + newString = this.getWhereClauseBlock(node, fullText); + break; + case SyntaxNodeType.QueryTuning: + newString = + " " + FormatterHelper.getCurrentText(node, fullText).trim(); + break; + default: + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = text.length === 0 ? "" : " " + text; + break; + } + + return newString; + } + + private getWhereClauseBlock( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + + node.children.forEach((child) => { + switch (child.type) { + case SyntaxNodeType.LogicalExpression: + resultString = resultString.concat( + this.getLogicalExpressionBlock( + child, + fullText, + child.startPosition.column + ) + ); + break; + case SyntaxNodeType.WhereKeyword: + resultString = resultString.concat( + " ", + FormatterHelper.getCurrentText(child, fullText).trim() + ); + break; + case SyntaxNodeType.ComparisonExpression: + resultString = resultString.concat( + this.getComparisonExpressionBlock(child, fullText) + ); + break; + default: + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + resultString = text.length === 0 ? "" : " " + text; + break; + } + }); + + return resultString; + } + + private getComparisonExpressionBlock( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + + node.children.forEach((child) => { + resultString = resultString.concat( + " ", + FormatterHelper.getCurrentText(child, fullText).trim() + ); + }); + + return resultString; + } + + private getLogicalExpressionBlock( + node: SyntaxNode, + fullText: Readonly, + LogicalExpressionStartColumn: number + ): string { + let resultString = ""; + + node.children.forEach((child) => { + resultString = resultString.concat( + this.getLogicalExpressionString( + child, + fullText, + LogicalExpressionStartColumn + ) + ); + }); + + return resultString; + } + + private getLogicalExpressionString( + node: SyntaxNode, + fullText: Readonly, + LogicalExpressionStartColumn: number + ): string { + let newString = ""; + + switch (node.type) { + case SyntaxNodeType.OrKeyword: + case SyntaxNodeType.AndKeyword: + newString = + " " + + FormatterHelper.getCurrentText(node, fullText).trim() + + fullText.eolDelimiter + + " ".repeat(LogicalExpressionStartColumn); + break; + case SyntaxNodeType.LogicalExpression: + newString = this.getLogicalExpressionBlock( + node, + fullText, + LogicalExpressionStartColumn + ); + break; + default: + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = text.length === 0 ? "" : " " + text; + break; + } + + return newString; + } + + private getStartColumn(node: SyntaxNode): number { + if (node.type === SyntaxNodeType.FindKeyword) { + return node.startPosition.column; + } else { + return this.findParentFindStatementStartColumn(node); + } + } + + private findParentFindStatementStartColumn(node: SyntaxNode): number { + if (node.parent === null) { + return 0; + } + + return node.type === SyntaxNodeType.FindKeyword + ? node.startPosition.column + : this.findParentFindStatementStartColumn(node.parent); + } +} diff --git a/src/v2/formatters/find/FindSettings.ts b/src/v2/formatters/find/FindSettings.ts new file mode 100644 index 0000000..a088786 --- /dev/null +++ b/src/v2/formatters/find/FindSettings.ts @@ -0,0 +1,8 @@ +import { ASettings } from "../ASettings"; + +export class FindSettings extends ASettings { + // token settings + public findFormatting() { + return this.configurationManager.get("findFormatting") ? true : false; + } +} From cc4e797836c5ca31e282d8f5630067f968d8b388 Mon Sep 17 00:00:00 2001 From: sjonynaite Date: Mon, 26 Aug 2024 10:17:16 +0300 Subject: [PATCH 2/6] Updated test structure --- .../1find-firstLastNextPrev}/input.p | 0 .../1find-firstLastNextPrev}/target.p | 0 .../2find-multipleConditions}/input.p | 0 .../2find-multipleConditions}/target.p | 0 .../3find-multipleConditions-()}/input.p | 0 .../3find-multipleConditions-()}/target.p | 0 .../4find-multipleConditions-()2}/input.p | 0 .../4find-multipleConditions-()2}/target.p | 0 .../functionalTests/{find-spaces => find/5find-spaces}/input.p | 0 .../functionalTests/{find-spaces => find/5find-spaces}/target.p | 0 .../{find-useIndex => find/6find-useIndex}/input.p | 0 .../{find-useIndex => find/6find-useIndex}/target.p | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename resources/functionalTests/{find-firstLastNextPrev => find/1find-firstLastNextPrev}/input.p (100%) rename resources/functionalTests/{find-firstLastNextPrev => find/1find-firstLastNextPrev}/target.p (100%) rename resources/functionalTests/{find-multipleConditions => find/2find-multipleConditions}/input.p (100%) rename resources/functionalTests/{find-multipleConditions => find/2find-multipleConditions}/target.p (100%) rename resources/functionalTests/{find-multipleConditions-() => find/3find-multipleConditions-()}/input.p (100%) rename resources/functionalTests/{find-multipleConditions-() => find/3find-multipleConditions-()}/target.p (100%) rename resources/functionalTests/{find-multipleConditions-()2 => find/4find-multipleConditions-()2}/input.p (100%) rename resources/functionalTests/{find-multipleConditions-()2 => find/4find-multipleConditions-()2}/target.p (100%) rename resources/functionalTests/{find-spaces => find/5find-spaces}/input.p (100%) rename resources/functionalTests/{find-spaces => find/5find-spaces}/target.p (100%) rename resources/functionalTests/{find-useIndex => find/6find-useIndex}/input.p (100%) rename resources/functionalTests/{find-useIndex => find/6find-useIndex}/target.p (100%) diff --git a/resources/functionalTests/find-firstLastNextPrev/input.p b/resources/functionalTests/find/1find-firstLastNextPrev/input.p similarity index 100% rename from resources/functionalTests/find-firstLastNextPrev/input.p rename to resources/functionalTests/find/1find-firstLastNextPrev/input.p diff --git a/resources/functionalTests/find-firstLastNextPrev/target.p b/resources/functionalTests/find/1find-firstLastNextPrev/target.p similarity index 100% rename from resources/functionalTests/find-firstLastNextPrev/target.p rename to resources/functionalTests/find/1find-firstLastNextPrev/target.p diff --git a/resources/functionalTests/find-multipleConditions/input.p b/resources/functionalTests/find/2find-multipleConditions/input.p similarity index 100% rename from resources/functionalTests/find-multipleConditions/input.p rename to resources/functionalTests/find/2find-multipleConditions/input.p diff --git a/resources/functionalTests/find-multipleConditions/target.p b/resources/functionalTests/find/2find-multipleConditions/target.p similarity index 100% rename from resources/functionalTests/find-multipleConditions/target.p rename to resources/functionalTests/find/2find-multipleConditions/target.p diff --git a/resources/functionalTests/find-multipleConditions-()/input.p b/resources/functionalTests/find/3find-multipleConditions-()/input.p similarity index 100% rename from resources/functionalTests/find-multipleConditions-()/input.p rename to resources/functionalTests/find/3find-multipleConditions-()/input.p diff --git a/resources/functionalTests/find-multipleConditions-()/target.p b/resources/functionalTests/find/3find-multipleConditions-()/target.p similarity index 100% rename from resources/functionalTests/find-multipleConditions-()/target.p rename to resources/functionalTests/find/3find-multipleConditions-()/target.p diff --git a/resources/functionalTests/find-multipleConditions-()2/input.p b/resources/functionalTests/find/4find-multipleConditions-()2/input.p similarity index 100% rename from resources/functionalTests/find-multipleConditions-()2/input.p rename to resources/functionalTests/find/4find-multipleConditions-()2/input.p diff --git a/resources/functionalTests/find-multipleConditions-()2/target.p b/resources/functionalTests/find/4find-multipleConditions-()2/target.p similarity index 100% rename from resources/functionalTests/find-multipleConditions-()2/target.p rename to resources/functionalTests/find/4find-multipleConditions-()2/target.p diff --git a/resources/functionalTests/find-spaces/input.p b/resources/functionalTests/find/5find-spaces/input.p similarity index 100% rename from resources/functionalTests/find-spaces/input.p rename to resources/functionalTests/find/5find-spaces/input.p diff --git a/resources/functionalTests/find-spaces/target.p b/resources/functionalTests/find/5find-spaces/target.p similarity index 100% rename from resources/functionalTests/find-spaces/target.p rename to resources/functionalTests/find/5find-spaces/target.p diff --git a/resources/functionalTests/find-useIndex/input.p b/resources/functionalTests/find/6find-useIndex/input.p similarity index 100% rename from resources/functionalTests/find-useIndex/input.p rename to resources/functionalTests/find/6find-useIndex/input.p diff --git a/resources/functionalTests/find-useIndex/target.p b/resources/functionalTests/find/6find-useIndex/target.p similarity index 100% rename from resources/functionalTests/find-useIndex/target.p rename to resources/functionalTests/find/6find-useIndex/target.p From 329e1c5be21c3aa319d4b2182c677634c1db2d8c Mon Sep 17 00:00:00 2001 From: sjonynaite Date: Mon, 26 Aug 2024 15:28:41 +0300 Subject: [PATCH 3/6] Update AssignFormatter --- .../find/1find-firstLastNextPrev/target.p | 8 - .../input.p | 5 +- .../find/1firstLastNextPrev/target.p | 11 ++ .../find/2find-multipleConditions/input.p | 8 - .../find/2find-multipleConditions/target.p | 8 - .../find/2multipleConditions/input.p | 5 + .../find/2multipleConditions/target.p | 5 + .../find/3find-multipleConditions-()/input.p | 6 - .../find/3find-multipleConditions-()/target.p | 6 - .../find/3multipleConditions-()/input.p | 4 + .../find/3multipleConditions-()/target.p | 5 + .../find/4find-multipleConditions-()2/input.p | 6 - .../4find-multipleConditions-()2/target.p | 6 - .../find/4multipleConditions-()2/input.p | 4 + .../find/4multipleConditions-()2/target.p | 5 + .../functionalTests/find/5find-spaces/input.p | 5 - .../find/5find-spaces/target.p | 5 - .../functionalTests/find/5spaces/input.p | 4 + .../functionalTests/find/5spaces/target.p | 5 + .../find/6find-useIndex/target.p | 6 - .../{6find-useIndex => 6useIndex}/input.p | 3 +- .../functionalTests/find/6useIndex/target.p | 5 + .../functionalTests/find/7noWhere/input.p | 5 + .../functionalTests/find/7noWhere/target.p | 4 + src/model/SyntaxNodeType.ts | 1 + src/v2/formatters/find/FindFormatter.ts | 155 +++--------------- 26 files changed, 93 insertions(+), 197 deletions(-) delete mode 100644 resources/functionalTests/find/1find-firstLastNextPrev/target.p rename resources/functionalTests/find/{1find-firstLastNextPrev => 1firstLastNextPrev}/input.p (61%) create mode 100644 resources/functionalTests/find/1firstLastNextPrev/target.p delete mode 100644 resources/functionalTests/find/2find-multipleConditions/input.p delete mode 100644 resources/functionalTests/find/2find-multipleConditions/target.p create mode 100644 resources/functionalTests/find/2multipleConditions/input.p create mode 100644 resources/functionalTests/find/2multipleConditions/target.p delete mode 100644 resources/functionalTests/find/3find-multipleConditions-()/input.p delete mode 100644 resources/functionalTests/find/3find-multipleConditions-()/target.p create mode 100644 resources/functionalTests/find/3multipleConditions-()/input.p create mode 100644 resources/functionalTests/find/3multipleConditions-()/target.p delete mode 100644 resources/functionalTests/find/4find-multipleConditions-()2/input.p delete mode 100644 resources/functionalTests/find/4find-multipleConditions-()2/target.p create mode 100644 resources/functionalTests/find/4multipleConditions-()2/input.p create mode 100644 resources/functionalTests/find/4multipleConditions-()2/target.p delete mode 100644 resources/functionalTests/find/5find-spaces/input.p delete mode 100644 resources/functionalTests/find/5find-spaces/target.p create mode 100644 resources/functionalTests/find/5spaces/input.p create mode 100644 resources/functionalTests/find/5spaces/target.p delete mode 100644 resources/functionalTests/find/6find-useIndex/target.p rename resources/functionalTests/find/{6find-useIndex => 6useIndex}/input.p (61%) create mode 100644 resources/functionalTests/find/6useIndex/target.p create mode 100644 resources/functionalTests/find/7noWhere/input.p create mode 100644 resources/functionalTests/find/7noWhere/target.p diff --git a/resources/functionalTests/find/1find-firstLastNextPrev/target.p b/resources/functionalTests/find/1find-firstLastNextPrev/target.p deleted file mode 100644 index 0b3d193..0000000 --- a/resources/functionalTests/find/1find-firstLastNextPrev/target.p +++ /dev/null @@ -1,8 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND FIRST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. -FIND LAST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. -FIND NEXT Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. -FIND PREV Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/1find-firstLastNextPrev/input.p b/resources/functionalTests/find/1firstLastNextPrev/input.p similarity index 61% rename from resources/functionalTests/find/1find-firstLastNextPrev/input.p rename to resources/functionalTests/find/1firstLastNextPrev/input.p index b2b68c7..699c876 100644 --- a/resources/functionalTests/find/1find-firstLastNextPrev/input.p +++ b/resources/functionalTests/find/1firstLastNextPrev/input.p @@ -1,8 +1,7 @@ /* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ +/* { "AblFormatter.findFormatting": true}*/ FIND FIRST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. FIND LAST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. -FIND NEXT Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND NEXT Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. FIND PREV Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/1firstLastNextPrev/target.p b/resources/functionalTests/find/1firstLastNextPrev/target.p new file mode 100644 index 0000000..cfc3874 --- /dev/null +++ b/resources/functionalTests/find/1firstLastNextPrev/target.p @@ -0,0 +1,11 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND FIRST Customer WHERE + Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND LAST Customer WHERE + Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND NEXT Customer WHERE + Customer.CustNum = 5 NO-LOCK NO-ERROR. +FIND PREV Customer WHERE + Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/2find-multipleConditions/input.p b/resources/functionalTests/find/2find-multipleConditions/input.p deleted file mode 100644 index 0747c5d..0000000 --- a/resources/functionalTests/find/2find-multipleConditions/input.p +++ /dev/null @@ -1,8 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE -Customer.CustNum = 5 AND Customer.CustNum = 6 OR - Customer.CustNum = 7 AND - Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find/2find-multipleConditions/target.p b/resources/functionalTests/find/2find-multipleConditions/target.p deleted file mode 100644 index 5a116d0..0000000 --- a/resources/functionalTests/find/2find-multipleConditions/target.p +++ /dev/null @@ -1,8 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE Customer.CustNum = 5 AND - Customer.CustNum = 6 OR - Customer.CustNum = 7 AND - Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find/2multipleConditions/input.p b/resources/functionalTests/find/2multipleConditions/input.p new file mode 100644 index 0000000..50c502a --- /dev/null +++ b/resources/functionalTests/find/2multipleConditions/input.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Customer WHERE +Customer.CustNum = 5 AND Customer.CustNum = 6 OR Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find/2multipleConditions/target.p b/resources/functionalTests/find/2multipleConditions/target.p new file mode 100644 index 0000000..fe06937 --- /dev/null +++ b/resources/functionalTests/find/2multipleConditions/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Customer WHERE + Customer.CustNum = 5 AND Customer.CustNum = 6 OR Customer.CustNum = 8 no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find/3find-multipleConditions-()/input.p b/resources/functionalTests/find/3find-multipleConditions-()/input.p deleted file mode 100644 index 46cf014..0000000 --- a/resources/functionalTests/find/3find-multipleConditions-()/input.p +++ /dev/null @@ -1,6 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE (Customer.CustNum > 50 AND Customer.CustNum < 100) OR - Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/3find-multipleConditions-()/target.p b/resources/functionalTests/find/3find-multipleConditions-()/target.p deleted file mode 100644 index 37f2585..0000000 --- a/resources/functionalTests/find/3find-multipleConditions-()/target.p +++ /dev/null @@ -1,6 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE (Customer.CustNum > 50 AND Customer.CustNum < 100) OR - Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/3multipleConditions-()/input.p b/resources/functionalTests/find/3multipleConditions-()/input.p new file mode 100644 index 0000000..57b76b6 --- /dev/null +++ b/resources/functionalTests/find/3multipleConditions-()/input.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Customer WHERE (Customer.CustNum > 50 AND Customer.CustNum < 100) OR Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/3multipleConditions-()/target.p b/resources/functionalTests/find/3multipleConditions-()/target.p new file mode 100644 index 0000000..2cdc88a --- /dev/null +++ b/resources/functionalTests/find/3multipleConditions-()/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Customer WHERE + (Customer.CustNum > 50 AND Customer.CustNum < 100) OR Customer.CustNum > 200 NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/4find-multipleConditions-()2/input.p b/resources/functionalTests/find/4find-multipleConditions-()2/input.p deleted file mode 100644 index 34d84c2..0000000 --- a/resources/functionalTests/find/4find-multipleConditions-()2/input.p +++ /dev/null @@ -1,6 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Order WHERE (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR -(Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find/4find-multipleConditions-()2/target.p b/resources/functionalTests/find/4find-multipleConditions-()2/target.p deleted file mode 100644 index 0b14b40..0000000 --- a/resources/functionalTests/find/4find-multipleConditions-()2/target.p +++ /dev/null @@ -1,6 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Order WHERE (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR - (Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find/4multipleConditions-()2/input.p b/resources/functionalTests/find/4multipleConditions-()2/input.p new file mode 100644 index 0000000..4eb239d --- /dev/null +++ b/resources/functionalTests/find/4multipleConditions-()2/input.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Order WHERE (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR (Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find/4multipleConditions-()2/target.p b/resources/functionalTests/find/4multipleConditions-()2/target.p new file mode 100644 index 0000000..39b6cdf --- /dev/null +++ b/resources/functionalTests/find/4multipleConditions-()2/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Order WHERE + (Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR (Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock. \ No newline at end of file diff --git a/resources/functionalTests/find/5find-spaces/input.p b/resources/functionalTests/find/5find-spaces/input.p deleted file mode 100644 index d70cac2..0000000 --- a/resources/functionalTests/find/5find-spaces/input.p +++ /dev/null @@ -1,5 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/5find-spaces/target.p b/resources/functionalTests/find/5find-spaces/target.p deleted file mode 100644 index 9996f9e..0000000 --- a/resources/functionalTests/find/5find-spaces/target.p +++ /dev/null @@ -1,5 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -FIND Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/5spaces/input.p b/resources/functionalTests/find/5spaces/input.p new file mode 100644 index 0000000..8a056f5 --- /dev/null +++ b/resources/functionalTests/find/5spaces/input.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + + FIND FIRST Customer WHERE Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/5spaces/target.p b/resources/functionalTests/find/5spaces/target.p new file mode 100644 index 0000000..e0b3888 --- /dev/null +++ b/resources/functionalTests/find/5spaces/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + + FIND FIRST Customer WHERE + Customer.CustNum = 5 NO-LOCK NO-ERROR. \ No newline at end of file diff --git a/resources/functionalTests/find/6find-useIndex/target.p b/resources/functionalTests/find/6find-useIndex/target.p deleted file mode 100644 index 4fcd22c..0000000 --- a/resources/functionalTests/find/6find-useIndex/target.p +++ /dev/null @@ -1,6 +0,0 @@ -/* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ - -find Order where Order.OrderStatus = "Shipped" and - Order.ShipDate = today use-index OrderNum. \ No newline at end of file diff --git a/resources/functionalTests/find/6find-useIndex/input.p b/resources/functionalTests/find/6useIndex/input.p similarity index 61% rename from resources/functionalTests/find/6find-useIndex/input.p rename to resources/functionalTests/find/6useIndex/input.p index 6a13e2c..73cb455 100644 --- a/resources/functionalTests/find/6find-useIndex/input.p +++ b/resources/functionalTests/find/6useIndex/input.p @@ -1,5 +1,4 @@ /* formatterSettingsOverride */ -/* { "AblFormatter.findFormatting": true, -"abl.completion.upperCase": true}*/ +/* { "AblFormatter.findFormatting": true}*/ find Order where Order.OrderStatus = "Shipped" and Order.ShipDate = today use-index OrderNum. \ No newline at end of file diff --git a/resources/functionalTests/find/6useIndex/target.p b/resources/functionalTests/find/6useIndex/target.p new file mode 100644 index 0000000..4b8db54 --- /dev/null +++ b/resources/functionalTests/find/6useIndex/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +find Order where + Order.OrderStatus = "Shipped" and Order.ShipDate = today use-index OrderNum. \ No newline at end of file diff --git a/resources/functionalTests/find/7noWhere/input.p b/resources/functionalTests/find/7noWhere/input.p new file mode 100644 index 0000000..b362157 --- /dev/null +++ b/resources/functionalTests/find/7noWhere/input.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +find first b_vac +no-lock no-error. \ No newline at end of file diff --git a/resources/functionalTests/find/7noWhere/target.p b/resources/functionalTests/find/7noWhere/target.p new file mode 100644 index 0000000..8246220 --- /dev/null +++ b/resources/functionalTests/find/7noWhere/target.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +find first b_vac no-lock no-error. \ No newline at end of file diff --git a/src/model/SyntaxNodeType.ts b/src/model/SyntaxNodeType.ts index 286811e..f0a4c18 100644 --- a/src/model/SyntaxNodeType.ts +++ b/src/model/SyntaxNodeType.ts @@ -19,6 +19,7 @@ export enum SyntaxNodeType { WhereClause = "where_clause", AssignStatement = "assign_statement", Assignment = "assignment", + Identifier = "identifier", SourceCode = "source_code", ForStatement = "for_statement", QueryTuning = "query_tuning", diff --git a/src/v2/formatters/find/FindFormatter.ts b/src/v2/formatters/find/FindFormatter.ts index 7975024..68d3338 100644 --- a/src/v2/formatters/find/FindFormatter.ts +++ b/src/v2/formatters/find/FindFormatter.ts @@ -9,14 +9,6 @@ import { RegisterFormatter } from "../../formatterFramework/formatterDecorator"; import { FindSettings } from "./FindSettings"; import { IConfigurationManager } from "../../../utils/IConfigurationManager"; -/** - * Note: The WHERE clause block with multiple LogicalExpressions does not align correctly - * during the first formatting if there are spaces before the WHERE clause. - * - * Question: Should QueryTuning also be formatted in a similar manner to LogicalExpressions, - * with aligned spacing and line breaks? - */ - @RegisterFormatter export class FindFormatter extends AFormatter implements IFormatter { private startColumn = 0; @@ -51,7 +43,7 @@ export class FindFormatter extends AFormatter implements IFormatter { node: SyntaxNode, fullText: Readonly ) { - this.startColumn = this.getStartColumn(node); + this.startColumn = node.startPosition.column; this.findBodyValue = this.getFindStatementBlock(node, fullText); } @@ -60,35 +52,40 @@ export class FindFormatter extends AFormatter implements IFormatter { fullText: Readonly ): string { let resultString = ""; + let alignColumn = 0; node.children.forEach((child) => { + if (child.type === SyntaxNodeType.Identifier) { + alignColumn = this.startColumn + resultString.length; + } resultString = resultString.concat( - this.getFindExpressionString(child, fullText) + this.getFindExpressionString(child, fullText, alignColumn) ); }); - resultString = resultString.concat("."); - return resultString; + return resultString + "."; } private getFindExpressionString( node: SyntaxNode, - fullText: Readonly + fullText: Readonly, + alignColumn: number ): string { let newString = ""; switch (node.type) { case SyntaxNodeType.FindKeyword: - newString = - " ".repeat(this.startColumn) + - FormatterHelper.getCurrentText(node, fullText).trim(); + newString = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); break; case SyntaxNodeType.WhereClause: - newString = this.getWhereClauseBlock(node, fullText); - break; - case SyntaxNodeType.QueryTuning: - newString = - " " + FormatterHelper.getCurrentText(node, fullText).trim(); + newString = this.getWhereClauseBlock( + node, + fullText, + alignColumn + ); break; default: const text = FormatterHelper.getCurrentText( @@ -104,131 +101,33 @@ export class FindFormatter extends AFormatter implements IFormatter { private getWhereClauseBlock( node: SyntaxNode, - fullText: Readonly + fullText: Readonly, + alignColumn: number ): string { let resultString = ""; node.children.forEach((child) => { switch (child.type) { - case SyntaxNodeType.LogicalExpression: - resultString = resultString.concat( - this.getLogicalExpressionBlock( - child, - fullText, - child.startPosition.column - ) - ); - break; case SyntaxNodeType.WhereKeyword: resultString = resultString.concat( " ", - FormatterHelper.getCurrentText(child, fullText).trim() - ); - break; - case SyntaxNodeType.ComparisonExpression: - resultString = resultString.concat( - this.getComparisonExpressionBlock(child, fullText) + FormatterHelper.getCurrentText(child, fullText).trim(), + fullText.eolDelimiter, + " ".repeat(alignColumn) ); break; default: const text = FormatterHelper.getCurrentText( - node, + child, fullText ).trim(); - resultString = text.length === 0 ? "" : " " + text; + resultString = resultString.concat( + text.length === 0 ? "" : " " + text + ); break; } }); return resultString; } - - private getComparisonExpressionBlock( - node: SyntaxNode, - fullText: Readonly - ): string { - let resultString = ""; - - node.children.forEach((child) => { - resultString = resultString.concat( - " ", - FormatterHelper.getCurrentText(child, fullText).trim() - ); - }); - - return resultString; - } - - private getLogicalExpressionBlock( - node: SyntaxNode, - fullText: Readonly, - LogicalExpressionStartColumn: number - ): string { - let resultString = ""; - - node.children.forEach((child) => { - resultString = resultString.concat( - this.getLogicalExpressionString( - child, - fullText, - LogicalExpressionStartColumn - ) - ); - }); - - return resultString; - } - - private getLogicalExpressionString( - node: SyntaxNode, - fullText: Readonly, - LogicalExpressionStartColumn: number - ): string { - let newString = ""; - - switch (node.type) { - case SyntaxNodeType.OrKeyword: - case SyntaxNodeType.AndKeyword: - newString = - " " + - FormatterHelper.getCurrentText(node, fullText).trim() + - fullText.eolDelimiter + - " ".repeat(LogicalExpressionStartColumn); - break; - case SyntaxNodeType.LogicalExpression: - newString = this.getLogicalExpressionBlock( - node, - fullText, - LogicalExpressionStartColumn - ); - break; - default: - const text = FormatterHelper.getCurrentText( - node, - fullText - ).trim(); - newString = text.length === 0 ? "" : " " + text; - break; - } - - return newString; - } - - private getStartColumn(node: SyntaxNode): number { - if (node.type === SyntaxNodeType.FindKeyword) { - return node.startPosition.column; - } else { - return this.findParentFindStatementStartColumn(node); - } - } - - private findParentFindStatementStartColumn(node: SyntaxNode): number { - if (node.parent === null) { - return 0; - } - - return node.type === SyntaxNodeType.FindKeyword - ? node.startPosition.column - : this.findParentFindStatementStartColumn(node.parent); - } } From 57d4153a5cacbed04d449742d1971d148a4e03da Mon Sep 17 00:00:00 2001 From: gmickus Date: Fri, 13 Sep 2024 10:29:30 +0300 Subject: [PATCH 4/6] Add test --- resources/functionalTests/find/7no-wait/input.p | 4 ++++ resources/functionalTests/find/7no-wait/target.p | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 resources/functionalTests/find/7no-wait/input.p create mode 100644 resources/functionalTests/find/7no-wait/target.p diff --git a/resources/functionalTests/find/7no-wait/input.p b/resources/functionalTests/find/7no-wait/input.p new file mode 100644 index 0000000..4740485 --- /dev/null +++ b/resources/functionalTests/find/7no-wait/input.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Order WHERE Order.CustomerID = Customer.CustomerID NO-WAIT. \ No newline at end of file diff --git a/resources/functionalTests/find/7no-wait/target.p b/resources/functionalTests/find/7no-wait/target.p new file mode 100644 index 0000000..3828ffc --- /dev/null +++ b/resources/functionalTests/find/7no-wait/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Order WHERE + Order.CustomerID = Customer.CustomerID NO-WAIT. \ No newline at end of file From 8912b7cceff15ee00de5fe072453659489880184 Mon Sep 17 00:00:00 2001 From: gmickus Date: Fri, 13 Sep 2024 10:35:26 +0300 Subject: [PATCH 5/6] Add test --- resources/functionalTests/find/7of-table/input.p | 4 ++++ resources/functionalTests/find/7of-table/target.p | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 resources/functionalTests/find/7of-table/input.p create mode 100644 resources/functionalTests/find/7of-table/target.p diff --git a/resources/functionalTests/find/7of-table/input.p b/resources/functionalTests/find/7of-table/input.p new file mode 100644 index 0000000..4740485 --- /dev/null +++ b/resources/functionalTests/find/7of-table/input.p @@ -0,0 +1,4 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND Order WHERE Order.CustomerID = Customer.CustomerID NO-WAIT. \ No newline at end of file diff --git a/resources/functionalTests/find/7of-table/target.p b/resources/functionalTests/find/7of-table/target.p new file mode 100644 index 0000000..f840fb9 --- /dev/null +++ b/resources/functionalTests/find/7of-table/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.findFormatting": true}*/ + +FIND FIRST Order OF Customer WHERE + Customer.Country = "USA" AND Customer.Balance > 1000. \ No newline at end of file From fb430cc15fe72f28ed74d15ab608fc25ef0226f4 Mon Sep 17 00:00:00 2001 From: gmickus Date: Fri, 13 Sep 2024 11:06:11 +0300 Subject: [PATCH 6/6] Update test --- resources/functionalTests/find/7of-table/input.p | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/functionalTests/find/7of-table/input.p b/resources/functionalTests/find/7of-table/input.p index 4740485..3022490 100644 --- a/resources/functionalTests/find/7of-table/input.p +++ b/resources/functionalTests/find/7of-table/input.p @@ -1,4 +1,4 @@ /* formatterSettingsOverride */ /* { "AblFormatter.findFormatting": true}*/ -FIND Order WHERE Order.CustomerID = Customer.CustomerID NO-WAIT. \ No newline at end of file +FIND FIRST Order OF Customer WHERE Customer.Country = "USA" AND Customer.Balance > 1000. \ No newline at end of file