Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

306 Default values #315

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"New",
"Same"
],
"description": "Should assigns be located on same or new line after ASSIGN keyword?"
"description": "Should assigns be located on a new line or the same line as the ASSIGN keyword?"
},
"AblFormatter.assignFormattingAlignRightExpression": {
"order": 102,
Expand All @@ -73,7 +73,7 @@
"New aligned",
"Same"
],
"description": "Should end dot be located on same or new line after ASSIGN statement?"
"description": "Should end dot be located on a new line or the same line as the ASSIGN keyword?"
},
"AblFormatter.findFormatting": {
"order": 300,
Expand Down Expand Up @@ -101,12 +101,12 @@
"New",
"Same"
],
"description": "Should THEN clause be on a new line or the same line as the WHEN keyword?"
"description": "Should THEN clause be on a new line or the same line as the CASE keyword?"
},
"AblFormatter.caseFormattingDoLocation": {
"order": 502,
"type": "string",
"default": "New",
"default": "Same",
"enum": [
"New",
"Same"
Expand Down Expand Up @@ -213,7 +213,7 @@
"New",
"Same"
],
"description": "Add a new line before the ELSE?"
"description": "Should ELSE clause be on a new line or the same line as the IF FUNCTION keyword?"
},
"AblFormatter.enumFormatting": {
"order": 1300,
Expand Down Expand Up @@ -267,7 +267,7 @@
"AblFormatter.arrayAccessFormattingAddSpaceAfterComma": {
"order": 1701,
"type": "string",
"default": "No",
"default": "Yes",
"enum": [
"Yes",
"No"
Expand All @@ -283,7 +283,7 @@
"AblFormatter.expressionFormattingLogicalLocation": {
"order": 1801,
"type": "string",
"default": "Same",
"default": "New",
"enum": [
"New",
"Same"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* formatterSettingsOverride */
/* { "AblFormatter.arrayAccessFormatting": true}*/

VAR INT[4] myArray = [10,11,12,13].
VAR INT[4] myArray = [10, 11, 12, 13].
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* formatterSettingsOverride */
/* { "AblFormatter.arrayAccessFormatting": true}*/

DEFINE VARIABLE myArray AS INTEGER EXTENT 5 NO-UNDO INITIAL [10,11,12,13,14].
DEFINE VARIABLE myArray AS INTEGER EXTENT 5 NO-UNDO INITIAL [10, 11, 12, 13, 14].

DISPLAY myArray[1 FOR 5].

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* formatterSettingsOverride */
/* { "AblFormatter.arrayAccessFormatting": true,
"AblFormatter.arrayAccessFormattingAddSpaceAfterComma": "No"}*/

VAR INT[] monthlySalesQuotas = [ 100500, 125000, 125000, 175000, 150000, 155000, 145000].
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* formatterSettingsOverride */
/* { "AblFormatter.arrayAccessFormatting": true,
"AblFormatter.arrayAccessFormattingAddSpaceAfterComma": "Yes"}*/
"AblFormatter.arrayAccessFormattingAddSpaceAfterComma": "No"}*/

VAR INT[] monthlySalesQuotas = [100500,125000,125000,175000,150000,155000,145000].
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/* formatterSettingsOverride */
/* { "abl.completion.upperCase": true,
"AblFormatter.caseFormatting": true,
"AblFormatter.blockFormatting": false}*/
PROCEDURE testCase:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
i = 1.
j = 2.
CASE i:
WHEN 1 THEN DO:
CASE j:
WHEN 1 THEN
MESSAGE "i=1, j=1".
WHEN 2 THEN
MESSAGE "i=1, j=2".
OTHERWISE
MESSAGE "i=1, j=Other".
END CASE.
END.
WHEN 2 THEN
MESSAGE "i=2".
OTHERWISE
MESSAGE "i=Other".
END CASE.
/* formatterSettingsOverride */
/* { "abl.completion.upperCase": true,
"AblFormatter.caseFormatting": true,
"AblFormatter.blockFormatting": true}*/

PROCEDURE testCase:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.

i = 1.
j = 2.

CASE i:
WHEN 1 THEN DO:
CASE j:
WHEN 1 THEN
MESSAGE "i=1, j=1".
WHEN 2 THEN
MESSAGE "i=1, j=2".
OTHERWISE
MESSAGE "i=1, j=Other".
END CASE.
END.
WHEN 2 THEN
MESSAGE "i=2".
OTHERWISE
MESSAGE "i=Other".
END CASE.
END PROCEDURE.
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
/* formatterSettingsOverride */
/* { "abl.completion.upperCase": true,
"AblFormatter.caseFormatting": true,
"AblFormatter.blockFormatting": false}*/

PROCEDURE testCase:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.

i = 1.
j = 2.

CASE i:
WHEN 1 THEN
DO:
CASE j:
WHEN 1 THEN
MESSAGE "i=1, j=1".
WHEN 2 THEN
MESSAGE "i=1, j=2".
OTHERWISE
MESSAGE "i=1, j=Other".
END CASE.
END.
WHEN 2 THEN
MESSAGE "i=2".
OTHERWISE
MESSAGE "i=Other".
END CASE.
/* formatterSettingsOverride */
/* { "abl.completion.upperCase": true,
"AblFormatter.caseFormatting": true,
"AblFormatter.blockFormatting": true}*/

PROCEDURE testCase:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.

i = 1.
j = 2.

CASE i:
WHEN 1 THEN DO:
CASE j:
WHEN 1 THEN
MESSAGE "i=1, j=1".
WHEN 2 THEN
MESSAGE "i=1, j=2".
OTHERWISE
MESSAGE "i=1, j=Other".
END CASE.
END.
WHEN 2 THEN
MESSAGE "i=2".
OTHERWISE
MESSAGE "i=Other".
END CASE.
END PROCEDURE.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ PROCEDURE testCase:
j = 2.

CASE i:
WHEN 1 THEN
DO:
WHEN 1 THEN DO:
CASE j:
WHEN 1 THEN
MESSAGE "i=1, j=1".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DEFINE VARIABLE iAge AS INTEGER NO-UNDO LABEL "Age of Person" INITIAL 0.
DEFINE VARIABLE dBirthDate AS DATE NO-UNDO FORMAT "99/99/9999" INITIAL TODAY.
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO INITIAL BUFFER Customer:HANDLE.
DEFINE VARIABLE mData AS MEMPTR NO-UNDO INITIAL ?.
DEFINE VARIABLE cJson AS CHARACTER NO-UNDO EXTENT 5 INITIAL ["","","","",""].
DEFINE VARIABLE cJson AS CHARACTER NO-UNDO EXTENT 5 INITIAL ["", "", "", "", ""].
DEFINE VARIABLE rAmount AS DECIMAL NO-UNDO FORMAT "->,>>>,>>9.99" INITIAL 0.
DEFINE VARIABLE lFlag AS LOGICAL NO-UNDO INITIAL FALSE.
DEFINE VARIABLE cXml AS LONGCHAR NO-UNDO INITIAL "".
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ define protected variable mBuffer as handle no-undo.
define protected variable ValidRecordsPerBlockNumbers as char no-undo init "1,2,4,8,16,32,64,128,256".
define protected variable ValidRecordsPerBlockString as char no-undo init "1, 2, 4, 8, 16, 32, 64, 128 and 256".
/* area type names */
define protected variable AreaTypeNames as char no-undo extent 7 init ["Undefined","Undefined","Recovery","Transaction log","Event log","Data","Rollforward recovery"].
define protected variable AreaTypeNames as char no-undo extent 7 init ["Undefined", "Undefined", "Recovery", "Transaction log", "Event log", "Data", "Rollforward recovery"].

4 changes: 3 additions & 1 deletion resources/functionalTests/find/2multipleConditions/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/* { "AblFormatter.findFormatting": true}*/

FIND Customer WHERE
Customer.CustNum = 5 AND Customer.CustNum = 6 OR Customer.CustNum = 8 no-lock no-error.
Customer.CustNum = 5 AND
Customer.CustNum = 6 OR
Customer.CustNum = 8 no-lock no-error.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/* { "AblFormatter.findFormatting": true}*/

FIND Customer WHERE
(Customer.CustNum > 50 AND Customer.CustNum < 100) OR Customer.CustNum > 200 NO-ERROR.
(Customer.CustNum > 50 AND
Customer.CustNum < 100) OR
Customer.CustNum > 200 NO-ERROR.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/* { "AblFormatter.findFormatting": true}*/

FIND Order WHERE
(Order.OrderStatus = "Shipped" AND (Order.ShipDate > TODAY - 7)) OR (Order.OrderStatus = "Pending" AND (Order.OrderDate = TODAY)) no-lock.
(Order.OrderStatus = "Shipped" AND
(Order.ShipDate > TODAY - 7)) OR
(Order.OrderStatus = "Pending" AND
(Order.OrderDate = TODAY)) no-lock.
3 changes: 2 additions & 1 deletion resources/functionalTests/find/6useIndex/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/* { "AblFormatter.findFormatting": true}*/

find Order where
Order.OrderStatus = "Shipped" and Order.ShipDate = today use-index OrderNum.
Order.OrderStatus = "Shipped" and
Order.ShipDate = today use-index OrderNum.
3 changes: 2 additions & 1 deletion resources/functionalTests/find/7of-table/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/* { "AblFormatter.findFormatting": true}*/

FIND FIRST Order OF Customer WHERE
Customer.Country = "USA" AND Customer.Balance > 1000.
Customer.Country = "USA" AND
Customer.Balance > 1000.
4 changes: 3 additions & 1 deletion resources/functionalTests/for/4each-where3/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
}*/

for each Customer where
Customer.var = 1 or Customer.var = 2 or Customer.var = 3:
Customer.var = 1 or
Customer.var = 2 or
Customer.var = 3:
Customer.var += 1.
end.
5 changes: 4 additions & 1 deletion resources/functionalTests/for/7each-complex/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
/* { "AblFormatter.forFormatting": true}*/

FOR EACH Customer NO-LOCK WHERE
(Customer.Balance > 10000 AND Customer.Region = "North") OR (Customer.Region = "South" AND Customer.Status = "Active")
(Customer.Balance > 10000 AND
Customer.Region = "North") OR
(Customer.Region = "South" AND
Customer.Status = "Active")
BY Customer.LastName
BY Customer.FirstName
BREAK BY Customer.City
Expand Down
3 changes: 2 additions & 1 deletion resources/functionalTests/if/18-then-same-do-new/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"AblFormatter.ifFormattingStatementLocation": "New",
"AblFormatter.ifFormattingDoLocation": "New"}*/

if something <> ? and something <> 0 then
if something <> ? and
something <> 0 then
oObject:method(something).
else if a = 3 then
do:
Expand Down
6 changes: 4 additions & 2 deletions resources/functionalTests/if/19-then-same-do-new/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
"AblFormatter.ifFormattingStatementLocation": "New",
"AblFormatter.ifFormattingDoLocation": "New"}*/

if something <> ? and something <> 0 then
if something <> ? and
something <> 0 then
oObject:method(something).
else if something <> ? or something <> ? then
else if something <> ? or
something <> ? then
do:
oObject:method(something).
end.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"AblFormatter.ifFormattingStatementLocation": "New",
"AblFormatter.ifFormattingDoLocation": "New"}*/

if something <> ? and something <> 0 then
if something <> ? and
something <> 0 then
oObject:method(something).
else if a = 3 then
do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

FOR EACH Customer NO-LOCK
BY (IF Customer.Balance > 10000 THEN 1
ELSE (IF Customer.Balance > 5000 THEN 1.5
ELSE (IF Customer.Balance > 1000 THEN 2
ELSE (IF Customer.Balance > 500 THEN 2.5
ELSE 3))))
ELSE (IF Customer.Balance > 5000 THEN 1.5
ELSE (IF Customer.Balance > 1000 THEN 2
ELSE (IF Customer.Balance > 500 THEN 2.5
ELSE 3))))
BY (IF Customer.SalesRep = "John" THEN 1
ELSE (IF Customer.SalesRep = "Jane" THEN 2
ELSE (IF Customer.SalesRep = "Doe" THEN 3
ELSE 4))):
ELSE (IF Customer.SalesRep = "Jane" THEN 2
ELSE (IF Customer.SalesRep = "Doe" THEN 3
ELSE 4))):
DISPLAY Customer.SalesRep Customer.Balance Customer.Name.
END.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/* { "AblFormatter.ifFunctionFormatting": true,
"AblFormatter.ifFunctionFormattingAddParentheses": "Yes"}*/

a = (if Customer.Balance > 10000 and Customer.Country = "USA" then 1 else 2).
a = (if Customer.Balance > 10000 and
Customer.Country = "USA" then 1 else 2).
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"AblFormatter.ifFunctionFormattingElseLocation": "New"}*/

a = (if Customer.Balance > 10000 then 1
else 2).
else 2).
Loading
Loading