diff --git a/package.json b/package.json index b0973c1..803465a 100644 --- a/package.json +++ b/package.json @@ -236,6 +236,18 @@ "Same" ] }, + "AblFormatter.variableDefinitionFormatting": { + "order": 1400, + "type": "boolean", + "default": "true", + "description": "Enable DEFINE VARIABLE formatting" + }, + "AblFormatter.procedureParameterFormatting": { + "order": 1500, + "type": "boolean", + "default": "true", + "description": "Enable PROCEDURE PARAMETER formatting" + }, "AblFormatter.showTreeInfoOnHover": { "order": 10100, "type": "boolean", diff --git a/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/input.p b/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/input.p index 2373fd5..5f9669c 100644 --- a/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/input.p +++ b/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN diff --git a/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/target.p b/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/target.p index a051d12..03f004e 100644 --- a/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/target.p +++ b/resources/functionalTests/assign/10sameLine-noRightAlign-newAlignedEndDot/target.p @@ -5,8 +5,5 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/input.p b/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/input.p index ad1340f..fbbc8d6 100644 --- a/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/input.p +++ b/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 diff --git a/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/target.p b/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/target.p index 30c340f..d95954b 100644 --- a/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/target.p +++ b/resources/functionalTests/assign/11sameLine-noRightAlign-newEndDot/target.p @@ -5,8 +5,5 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/input.p b/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/input.p index ba8bc80..6911f24 100644 --- a/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/input.p +++ b/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/input.p @@ -5,8 +5,5 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/target.p b/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/target.p index 71f640d..346770c 100644 --- a/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/target.p +++ b/resources/functionalTests/assign/12sameLine-noRightAlign-sameEndDot/target.p @@ -5,7 +5,4 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333. diff --git a/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/input.p b/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/input.p index 98f3a40..ca68e9c 100644 --- a/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/input.p +++ b/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/input.p @@ -5,7 +5,4 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 . diff --git a/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/target.p b/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/target.p index 9a92d7e..64a0c76 100644 --- a/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/target.p +++ b/resources/functionalTests/assign/13sameLine-RightAlign-newAlignedEndDot/target.p @@ -5,8 +5,5 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 . diff --git a/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/input.p b/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/input.p index 62809f5..bfafb61 100644 --- a/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/input.p +++ b/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 diff --git a/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/target.p b/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/target.p index 4f81521..76355a2 100644 --- a/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/target.p +++ b/resources/functionalTests/assign/14sameLine-RightAlign-sameEndDot/target.p @@ -5,7 +5,4 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333. diff --git a/resources/functionalTests/assign/15assign-noError/input.p b/resources/functionalTests/assign/15assign-noError/input.p index dc33d5e..71823b4 100644 --- a/resources/functionalTests/assign/15assign-noError/input.p +++ b/resources/functionalTests/assign/15assign-noError/input.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 number3 = 2 diff --git a/resources/functionalTests/assign/15assign-noError/target.p b/resources/functionalTests/assign/15assign-noError/target.p index 3ee04ef..af14a14 100644 --- a/resources/functionalTests/assign/15assign-noError/target.p +++ b/resources/functionalTests/assign/15assign-noError/target.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 number3 = 2 diff --git a/resources/functionalTests/assign/16assign-When/input.p b/resources/functionalTests/assign/16assign-When/input.p index c62a197..85db07a 100644 --- a/resources/functionalTests/assign/16assign-When/input.p +++ b/resources/functionalTests/assign/16assign-When/input.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 when number3 = 2 diff --git a/resources/functionalTests/assign/16assign-When/target.p b/resources/functionalTests/assign/16assign-When/target.p index 1254104..3c289de 100644 --- a/resources/functionalTests/assign/16assign-When/target.p +++ b/resources/functionalTests/assign/16assign-When/target.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 when number3 = 2 diff --git a/resources/functionalTests/assign/17assign-When-noError/input.p b/resources/functionalTests/assign/17assign-When-noError/input.p index f922e55..c564c36 100644 --- a/resources/functionalTests/assign/17assign-When-noError/input.p +++ b/resources/functionalTests/assign/17assign-When-noError/input.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 when diff --git a/resources/functionalTests/assign/17assign-When-noError/target.p b/resources/functionalTests/assign/17assign-When-noError/target.p index 05be5f1..73fbc1c 100644 --- a/resources/functionalTests/assign/17assign-When-noError/target.p +++ b/resources/functionalTests/assign/17assign-When-noError/target.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 when number3 = 2 diff --git a/resources/functionalTests/assign/17assign-When-noError2 copy/input.p b/resources/functionalTests/assign/17assign-When-noError2 copy/input.p index 5216cb6..f4fcc32 100644 --- a/resources/functionalTests/assign/17assign-When-noError2 copy/input.p +++ b/resources/functionalTests/assign/17assign-When-noError2 copy/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. ASSIGN number2 = 2 diff --git a/resources/functionalTests/assign/17assign-When-noError2 copy/target.p b/resources/functionalTests/assign/17assign-When-noError2 copy/target.p index 0aa36e6..ca06751 100644 --- a/resources/functionalTests/assign/17assign-When-noError2 copy/target.p +++ b/resources/functionalTests/assign/17assign-When-noError2 copy/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. ASSIGN number2 = 2 number11 = 2 when number3 = 2 NO-ERROR . diff --git a/resources/functionalTests/assign/17assign-When-noError2/input.p b/resources/functionalTests/assign/17assign-When-noError2/input.p index f50c1c3..441263b 100644 --- a/resources/functionalTests/assign/17assign-When-noError2/input.p +++ b/resources/functionalTests/assign/17assign-When-noError2/input.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 number11 = 2 when diff --git a/resources/functionalTests/assign/17assign-When-noError2/target.p b/resources/functionalTests/assign/17assign-When-noError2/target.p index fd2c7dd..03877b2 100644 --- a/resources/functionalTests/assign/17assign-When-noError2/target.p +++ b/resources/functionalTests/assign/17assign-When-noError2/target.p @@ -5,10 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO INITIAL 3. -DEFINE VARIABLE number3 AS INTEGER NO-UNDO INITIAL 3. - ASSIGN number2 = 2 number11 = 2 diff --git a/resources/functionalTests/assign/1formattingFalse/input.p b/resources/functionalTests/assign/1formattingFalse/input.p index bab958b..0663294 100644 --- a/resources/functionalTests/assign/1formattingFalse/input.p +++ b/resources/functionalTests/assign/1formattingFalse/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3 diff --git a/resources/functionalTests/assign/1formattingFalse/target.p b/resources/functionalTests/assign/1formattingFalse/target.p index bab958b..0663294 100644 --- a/resources/functionalTests/assign/1formattingFalse/target.p +++ b/resources/functionalTests/assign/1formattingFalse/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3 diff --git a/resources/functionalTests/assign/2inFunction/input.p b/resources/functionalTests/assign/2inFunction/input.p index fe22c62..ffe486b 100644 --- a/resources/functionalTests/assign/2inFunction/input.p +++ b/resources/functionalTests/assign/2inFunction/input.p @@ -6,9 +6,6 @@ "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ FUNCTION sumNumbers RETURNS INTEGER (number3 AS INTEGER, number4 AS INTEGER): - DEFINE VARIABLE number11 AS INTEGER NO-UNDO. - DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = number3 number2 = number4 diff --git a/resources/functionalTests/assign/2inFunction/target.p b/resources/functionalTests/assign/2inFunction/target.p index a41275d..d811b42 100644 --- a/resources/functionalTests/assign/2inFunction/target.p +++ b/resources/functionalTests/assign/2inFunction/target.p @@ -6,9 +6,6 @@ "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ FUNCTION sumNumbers RETURNS INTEGER (number3 AS INTEGER, number4 AS INTEGER): - DEFINE VARIABLE number11 AS INTEGER NO-UNDO. - DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = number3 number2 = number4 diff --git a/resources/functionalTests/assign/3inProcedure/input.p b/resources/functionalTests/assign/3inProcedure/input.p index 1d16215..c1f8a0f 100644 --- a/resources/functionalTests/assign/3inProcedure/input.p +++ b/resources/functionalTests/assign/3inProcedure/input.p @@ -6,9 +6,6 @@ "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ PROCEDURE sumNumbers: - DEFINE VARIABLE number11 AS INTEGER NO-UNDO. - DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = number3 number2 = number4 diff --git a/resources/functionalTests/assign/3inProcedure/target.p b/resources/functionalTests/assign/3inProcedure/target.p index 88888a4..8838fa1 100644 --- a/resources/functionalTests/assign/3inProcedure/target.p +++ b/resources/functionalTests/assign/3inProcedure/target.p @@ -6,9 +6,6 @@ "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ PROCEDURE sumNumbers: - DEFINE VARIABLE number11 AS INTEGER NO-UNDO. - DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = number3 number2 = number4 diff --git a/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/input.p b/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/input.p index d789b05..3b99f5c 100644 --- a/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/input.p +++ b/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 . diff --git a/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/target.p b/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/target.p index b0c1e45..c6f9786 100644 --- a/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/target.p +++ b/resources/functionalTests/assign/4newLine-noRightAlign-newAlignedEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 diff --git a/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/input.p b/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/input.p index 9c3361a..eb6517d 100644 --- a/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/input.p +++ b/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 diff --git a/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/target.p b/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/target.p index 1830c94..e08964d 100644 --- a/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/target.p +++ b/resources/functionalTests/assign/5newLine-noRightAlign-newEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 33333 diff --git a/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/input.p b/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/input.p index c918457..26fd990 100644 --- a/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/input.p +++ b/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 diff --git a/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/target.p b/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/target.p index e0fd7cc..64c7edb 100644 --- a/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/target.p +++ b/resources/functionalTests/assign/6newLine-noRightAlign-sameEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "No", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333. diff --git a/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/input.p b/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/input.p index 67e59ae..93739d6 100644 --- a/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/input.p +++ b/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/target.p b/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/target.p index 8f156bc..82f365a 100644 --- a/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/target.p +++ b/resources/functionalTests/assign/7newLine-RightAlign-newAlignedEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New aligned"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 diff --git a/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/input.p b/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/input.p index 8160626..188b8af 100644 --- a/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/input.p +++ b/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/input.p @@ -5,8 +5,5 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/target.p b/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/target.p index 6416ba0..deee7c3 100644 --- a/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/target.p +++ b/resources/functionalTests/assign/8newLine-RightAlign-newEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "New"}*/ -DEFINE VARIABLE number11 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number11 = 2 number2 = 3333 diff --git a/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/input.p b/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/input.p index 478dbaf..37ad921 100644 --- a/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/input.p +++ b/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/input.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number1 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number1 = 2 number2 = 3333 . diff --git a/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/target.p b/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/target.p index fa352d9..465ec87 100644 --- a/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/target.p +++ b/resources/functionalTests/assign/9newLine-RightAlign-sameEndDot/target.p @@ -5,9 +5,6 @@ "AblFormatter.assignFormattingAlignRightExpression": "Yes", "AblFormatter.assignFormattingEndDotLocation": "Same"}*/ -DEFINE VARIABLE number1 AS INTEGER NO-UNDO. -DEFINE VARIABLE number2 AS INTEGER NO-UNDO. - ASSIGN number1 = 2 number2 = 3333. diff --git a/resources/functionalTests/block/55class-extent/input.p b/resources/functionalTests/block/55class-extent/input.p new file mode 100644 index 0000000..07e9fef --- /dev/null +++ b/resources/functionalTests/block/55class-extent/input.p @@ -0,0 +1,9 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.blockFormatting": true}*/ + +class OpenEdge.DataAdmin.Rest.RestQueryFactory implements IRestQueryFactory: + method private char extent GetNamedQuery(pcname as char): + define variable cInfo as character extent no-undo. + return cInfo. + end. + end class. \ No newline at end of file diff --git a/resources/functionalTests/block/55class-extent/target.p b/resources/functionalTests/block/55class-extent/target.p new file mode 100644 index 0000000..6f26faa --- /dev/null +++ b/resources/functionalTests/block/55class-extent/target.p @@ -0,0 +1,9 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.blockFormatting": true}*/ + +class OpenEdge.DataAdmin.Rest.RestQueryFactory implements IRestQueryFactory: + method private char extent GetNamedQuery(pcname as char): + define variable cInfo as character extent no-undo. + return cInfo. + end. +end class. \ No newline at end of file diff --git a/resources/functionalTests/define/13tempTableAndDataset/target.p b/resources/functionalTests/define/13tempTableAndDataset/target.p index 32b7642..5fb3e1a 100644 --- a/resources/functionalTests/define/13tempTableAndDataset/target.p +++ b/resources/functionalTests/define/13tempTableAndDataset/target.p @@ -6,6 +6,6 @@ DEFINE TEMP-TABLE ttCustomer NO-UNDO FIELD CustNum AS INTEGER - FIELD Name AS CHARACTER. + FIELD Name AS CHARACTER. DEFINE DATASET dsCustomer FOR ttCustomer. diff --git a/resources/functionalTests/define/3formattingFalse/input.p b/resources/functionalTests/define/3formattingFalse/input.p index 47139ad..6f5b354 100644 --- a/resources/functionalTests/define/3formattingFalse/input.p +++ b/resources/functionalTests/define/3formattingFalse/input.p @@ -1,5 +1,6 @@ /* formatterSettingsOverride */ /* { "AblFormatter.defineFormatting": false, - "abl.completion.upperCase": true}*/ + "abl.completion.upperCase": true, + "AblFormatter.variableDefinitionFormatting": false}*/ DEFINE VARIABLE x AS INTEGER NO-UNDO. diff --git a/resources/functionalTests/define/3formattingFalse/target.p b/resources/functionalTests/define/3formattingFalse/target.p index 47139ad..6f5b354 100644 --- a/resources/functionalTests/define/3formattingFalse/target.p +++ b/resources/functionalTests/define/3formattingFalse/target.p @@ -1,5 +1,6 @@ /* formatterSettingsOverride */ /* { "AblFormatter.defineFormatting": false, - "abl.completion.upperCase": true}*/ + "abl.completion.upperCase": true, + "AblFormatter.variableDefinitionFormatting": false}*/ DEFINE VARIABLE x AS INTEGER NO-UNDO. diff --git a/resources/functionalTests/defineVariable/1comments/input.p b/resources/functionalTests/defineVariable/1comments/input.p new file mode 100644 index 0000000..e1cfb0d --- /dev/null +++ b/resources/functionalTests/defineVariable/1comments/input.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE lAutoCommit AS LOGICAL NO-UNDO. +// hi +define VARIABLE hDataQuery AS HANDLE NO-UNDO. +define VARIABLE lQueryContainer AS LOGICAL NO-UNDO. +// yes +define VARIABLE lBrowsed AS LOGICAL NO-UNDO. +define VARIABLE hMsgSource AS HANDLE NO-UNDO. +define variable candidatePath as character no-undo extent 2. +define variable candidateName as character no-undo extent 2. +define variable matchedFiles as Array no-undo. +define variable iLoop as integer no-undo. +define variable iMatchScore as integer no-undo extent. +define variable iBestScore as integer no-undo initial 0. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/1comments/target.p b/resources/functionalTests/defineVariable/1comments/target.p new file mode 100644 index 0000000..a7905af --- /dev/null +++ b/resources/functionalTests/defineVariable/1comments/target.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE lAutoCommit AS LOGICAL NO-UNDO. +// hi +define VARIABLE hDataQuery AS HANDLE NO-UNDO. +define VARIABLE lQueryContainer AS LOGICAL NO-UNDO. +// yes +define VARIABLE lBrowsed AS LOGICAL NO-UNDO. +define VARIABLE hMsgSource AS HANDLE NO-UNDO. +define variable candidatePath as character no-undo extent 2. +define variable candidateName as character no-undo extent 2. +define variable matchedFiles as Array no-undo. +define variable iLoop as integer no-undo. +define variable iMatchScore as integer no-undo extent. +define variable iBestScore as integer no-undo initial 0. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/1variables/input.p b/resources/functionalTests/defineVariable/1variables/input.p new file mode 100644 index 0000000..ab22339 --- /dev/null +++ b/resources/functionalTests/defineVariable/1variables/input.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE lAutoCommit AS LOGICAL NO-UNDO. +define VARIABLE hDataQuery AS HANDLE NO-UNDO. +define VARIABLE lQueryContainer AS LOGICAL NO-UNDO. +define VARIABLE lBrowsed AS LOGICAL NO-UNDO. +define VARIABLE hMsgSource AS HANDLE NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/1variables/target.p b/resources/functionalTests/defineVariable/1variables/target.p new file mode 100644 index 0000000..72976c7 --- /dev/null +++ b/resources/functionalTests/defineVariable/1variables/target.p @@ -0,0 +1,8 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE lAutoCommit AS LOGICAL NO-UNDO. +define VARIABLE hDataQuery AS HANDLE NO-UNDO. +define VARIABLE lQueryContainer AS LOGICAL NO-UNDO. +define VARIABLE lBrowsed AS LOGICAL NO-UNDO. +define VARIABLE hMsgSource AS HANDLE NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/1variables2/input.p b/resources/functionalTests/defineVariable/1variables2/input.p new file mode 100644 index 0000000..d3bcd4a --- /dev/null +++ b/resources/functionalTests/defineVariable/1variables2/input.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define variable procHandle as handle no-undo. +define variable procInfoList as Array no-undo. +define variable procAnnotInfo as ProcedureAnnotationInfo no-undo. +define variable testSuiteList as TestInfo no-undo. +define variable i as integer no-undo. +define variable testSuiteCount as integer no-undo init 0. +define variable annotationName as character no-undo. +define variable testProcInfo as TestInfo no-undo. +define variable procTestEntity as TestProcedure no-undo. +define variable typeInfo as TypeInfo no-undo. +define variable ignoreTest as logical no-undo. +define variable isTestProc as logical no-undo initial no. +define variable testInfo as TestInfo no-undo. diff --git a/resources/functionalTests/defineVariable/1variables2/target.p b/resources/functionalTests/defineVariable/1variables2/target.p new file mode 100644 index 0000000..05016e1 --- /dev/null +++ b/resources/functionalTests/defineVariable/1variables2/target.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define variable procHandle as handle no-undo. +define variable procInfoList as Array no-undo. +define variable procAnnotInfo as ProcedureAnnotationInfo no-undo. +define variable testSuiteList as TestInfo no-undo. +define variable i as integer no-undo. +define variable testSuiteCount as integer no-undo init 0. +define variable annotationName as character no-undo. +define variable testProcInfo as TestInfo no-undo. +define variable procTestEntity as TestProcedure no-undo. +define variable typeInfo as TypeInfo no-undo. +define variable ignoreTest as logical no-undo. +define variable isTestProc as logical no-undo initial no. +define variable testInfo as TestInfo no-undo. diff --git a/resources/functionalTests/defineVariable/2no-undo/input.p b/resources/functionalTests/defineVariable/2no-undo/input.p new file mode 100644 index 0000000..46d4eee --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo/input.p @@ -0,0 +1,31 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +DEFINE VARIABLE hRowBefore AS HANDLE NO-UNDO. +DEFINE VARIABLE cUpdColumnsByTable AS CHARACTER NO-UNDO. +DEFINE VARIABLE hRowUpdFld AS HANDLE NO-UNDO. +DEFINE VARIABLE hRowOldFld AS HANDLE NO-UNDO. +DEFINE VARIABLE hDBField AS HANDLE NO-UNDO. +DEFINE VARIABLE iField AS INTEGER NO-UNDO. +DEFINE VARIABLE iTable AS INTEGER NO-UNDO. +DEFINE VARIABLE cFromField AS CHARACTER NO-UNDO. +DEFINE VARIABLE cToField AS CHARACTER NO-UNDO. +DEFINE VARIABLE lColumnChanged AS LOGICAL NO-UNDO. +DEFINE VARIABLE iBracket AS INTEGER NO-UNDO. +DEFINE VARIABLE iExtent AS INTEGER NO-UNDO. +DEFINE VARIABLE cRowIdent AS CHARACTER NO-UNDO. +DEFINE VARIABLE cRowid AS CHARACTER NO-UNDO. +DEFINE VARIABLE cExclude AS CHARACTER NO-UNDO. +DEFINE VARIABLE cUpdColumns AS CHARACTER NO-UNDO. +DEFINE VARIABLE cColumnsByTable AS CHARACTER NO-UNDO. +DEFINE VARIABLE cColumns AS CHARACTER NO-UNDO. +DEFINE VARIABLE lChanged AS LOGICAL NO-UNDO. +DEFINE VARIABLE cNotChanged AS CHARACTER NO-UNDO. +DEFINE VARIABLE cAssignFields AS CHARACTER NO-UNDO. +DEFINE VARIABLE cUseAssignFields AS CHARACTER NO-UNDO. +DEFINE VARIABLE cDataColumns AS CHARACTER NO-UNDO. +DEFINE VARIABLE lAmbiguous AS LOGICAL NO-UNDO. +DEFINE VARIABLE lCreate AS LOGICAL NO-UNDO. +DEFINE VARIABLE lLarge AS LOGICAL NO-UNDO. +DEFINE VARIABLE cLargeList AS CHARACTER NO-UNDO. +DEFINE VARIABLE iLarge AS INTEGER NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/2no-undo/target.p b/resources/functionalTests/defineVariable/2no-undo/target.p new file mode 100644 index 0000000..26743a2 --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo/target.p @@ -0,0 +1,31 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE hRowBefore AS HANDLE NO-UNDO. +define VARIABLE cUpdColumnsByTable AS CHARACTER NO-UNDO. +define VARIABLE hRowUpdFld AS HANDLE NO-UNDO. +define VARIABLE hRowOldFld AS HANDLE NO-UNDO. +define VARIABLE hDBField AS HANDLE NO-UNDO. +define VARIABLE iField AS INTEGER NO-UNDO. +define VARIABLE iTable AS INTEGER NO-UNDO. +define VARIABLE cFromField AS CHARACTER NO-UNDO. +define VARIABLE cToField AS CHARACTER NO-UNDO. +define VARIABLE lColumnChanged AS LOGICAL NO-UNDO. +define VARIABLE iBracket AS INTEGER NO-UNDO. +define VARIABLE iExtent AS INTEGER NO-UNDO. +define VARIABLE cRowIdent AS CHARACTER NO-UNDO. +define VARIABLE cRowid AS CHARACTER NO-UNDO. +define VARIABLE cExclude AS CHARACTER NO-UNDO. +define VARIABLE cUpdColumns AS CHARACTER NO-UNDO. +define VARIABLE cColumnsByTable AS CHARACTER NO-UNDO. +define VARIABLE cColumns AS CHARACTER NO-UNDO. +define VARIABLE lChanged AS LOGICAL NO-UNDO. +define VARIABLE cNotChanged AS CHARACTER NO-UNDO. +define VARIABLE cAssignFields AS CHARACTER NO-UNDO. +define VARIABLE cUseAssignFields AS CHARACTER NO-UNDO. +define VARIABLE cDataColumns AS CHARACTER NO-UNDO. +define VARIABLE lAmbiguous AS LOGICAL NO-UNDO. +define VARIABLE lCreate AS LOGICAL NO-UNDO. +define VARIABLE lLarge AS LOGICAL NO-UNDO. +define VARIABLE cLargeList AS CHARACTER NO-UNDO. +define VARIABLE iLarge AS INTEGER NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/2no-undo3/input.p b/resources/functionalTests/defineVariable/2no-undo3/input.p new file mode 100644 index 0000000..217d84e --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo3/input.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define variable service as OpenEdge.DataAdmin.IDataAdminService no-undo. +define variable tableCollection as OpenEdge.DataAdmin.IDataAdminCollection no-undo. +define variable tableIter as OpenEdge.DataAdmin.Lang.Collections.IIterator no-undo. +define variable tablepolicy as OpenEdge.DataAdmin.ICdcTablePolicy no-undo. +define variable fieldpolicy as OpenEdge.DataAdmin.ICdcFieldPolicySet no-undo. +define variable i as int no-undo. +define variable polStr as longchar no-undo. +define variable tblName as char no-undo. +define variable tblList as longchar no-undo. +define variable polCnt as int no-undo. +define variable errMsg as char no-undo. +define variable j as int no-undo. +define variable polEntry as integer no-undo. diff --git a/resources/functionalTests/defineVariable/2no-undo3/target.p b/resources/functionalTests/defineVariable/2no-undo3/target.p new file mode 100644 index 0000000..71e9d5f --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo3/target.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define variable service as OpenEdge.DataAdmin.IDataAdminService no-undo. +define variable tableCollection as OpenEdge.DataAdmin.IDataAdminCollection no-undo. +define variable tableIter as OpenEdge.DataAdmin.Lang.Collections.IIterator no-undo. +define variable tablepolicy as OpenEdge.DataAdmin.ICdcTablePolicy no-undo. +define variable fieldpolicy as OpenEdge.DataAdmin.ICdcFieldPolicySet no-undo. +define variable i as int no-undo. +define variable polStr as longchar no-undo. +define variable tblName as char no-undo. +define variable tblList as longchar no-undo. +define variable polCnt as int no-undo. +define variable errMsg as char no-undo. +define variable j as int no-undo. +define variable polEntry as integer no-undo. diff --git a/resources/functionalTests/defineVariable/2no-undo4/input.p b/resources/functionalTests/defineVariable/2no-undo4/input.p new file mode 100644 index 0000000..266f105 --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo4/input.p @@ -0,0 +1,12 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +DEFINE VARIABLE cName AS CHARACTER NO-UNDO FORMAT "x(30)" INITIAL "Unknown". +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 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 "". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/2no-undo4/target.p b/resources/functionalTests/defineVariable/2no-undo4/target.p new file mode 100644 index 0000000..0050804 --- /dev/null +++ b/resources/functionalTests/defineVariable/2no-undo4/target.p @@ -0,0 +1,12 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE cName AS CHARACTER NO-UNDO FORMAT "x(30)" INITIAL "Unknown". +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 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 "". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/3as/input.p b/resources/functionalTests/defineVariable/3as/input.p new file mode 100644 index 0000000..c23f6f5 --- /dev/null +++ b/resources/functionalTests/defineVariable/3as/input.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE cName AS CHARACTER NO-UNDO FORMAT "x(30)" INITIAL "Unknown" LABEL "Customer Name". + +/* Example : Variable with decimals */ +define VARIABLE rPrice AS DECIMAL NO-UNDO DECIMALS 2 FORMAT "->,>>>,>>9.99" INITIAL 0 LABEL "Price". diff --git a/resources/functionalTests/defineVariable/3as/target.p b/resources/functionalTests/defineVariable/3as/target.p new file mode 100644 index 0000000..49c5869 --- /dev/null +++ b/resources/functionalTests/defineVariable/3as/target.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE cName AS CHARACTER NO-UNDO FORMAT "x(30)" INITIAL "Unknown" LABEL "Customer Name". + +/* Example : Variable with decimals */ +define VARIABLE rPrice AS DECIMAL NO-UNDO DECIMALS 2 FORMAT "->,>>>,>>9.99" INITIAL 0 LABEL "Price". diff --git a/resources/functionalTests/defineVariable/4define-protected/input.p b/resources/functionalTests/defineVariable/4define-protected/input.p new file mode 100644 index 0000000..3beefbe --- /dev/null +++ b/resources/functionalTests/defineVariable/4define-protected/input.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +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"]. + diff --git a/resources/functionalTests/defineVariable/4define-protected/target.p b/resources/functionalTests/defineVariable/4define-protected/target.p new file mode 100644 index 0000000..801f242 --- /dev/null +++ b/resources/functionalTests/defineVariable/4define-protected/target.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +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"]. + diff --git a/resources/functionalTests/defineVariable/5-new-shared/input.p b/resources/functionalTests/defineVariable/5-new-shared/input.p new file mode 100644 index 0000000..b5ad110 --- /dev/null +++ b/resources/functionalTests/defineVariable/5-new-shared/input.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define NEW SHARED VARIABLE RCodePath AS CHARACTER NO-UNDO INIT "". +define NEW SHARED VARIABLE SourceFileFull AS CHARACTER NO-UNDO INIT "". diff --git a/resources/functionalTests/defineVariable/5-new-shared/target.p b/resources/functionalTests/defineVariable/5-new-shared/target.p new file mode 100644 index 0000000..d99026f --- /dev/null +++ b/resources/functionalTests/defineVariable/5-new-shared/target.p @@ -0,0 +1,5 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define NEW SHARED VARIABLE RCodePath AS CHARACTER NO-UNDO INIT "". +define NEW SHARED VARIABLE SourceFileFull AS CHARACTER NO-UNDO INIT "". diff --git a/resources/functionalTests/defineVariable/6-procedure/input.p b/resources/functionalTests/defineVariable/6-procedure/input.p new file mode 100644 index 0000000..d773c50 --- /dev/null +++ b/resources/functionalTests/defineVariable/6-procedure/input.p @@ -0,0 +1,13 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +PROCEDURE addEntry: + DEFINE VARIABLE new_lang AS CHARACTER NO-UNDO EXTENT 1 INITIAL ["Reading Schema..."]. + DEFINE VARIABLE c AS CHARACTER NO-UNDO. + DEFINE VARIABLE useVar AS LOGICAL NO-UNDO INIT YES. + DEFINE VARIABLE totLen AS INT NO-UNDO. + DEFINE VARIABLE iNum AS INTEGER NO-UNDO INIT 0. + + + +END PROCEDURE. diff --git a/resources/functionalTests/defineVariable/6-procedure/target.p b/resources/functionalTests/defineVariable/6-procedure/target.p new file mode 100644 index 0000000..c5770d3 --- /dev/null +++ b/resources/functionalTests/defineVariable/6-procedure/target.p @@ -0,0 +1,13 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +PROCEDURE addEntry: + define VARIABLE new_lang AS CHARACTER NO-UNDO EXTENT 1 INITIAL ["Reading Schema..."]. + define VARIABLE c AS CHARACTER NO-UNDO. + define VARIABLE useVar AS LOGICAL NO-UNDO INIT YES. + define VARIABLE totLen AS INT NO-UNDO. + define VARIABLE iNum AS INTEGER NO-UNDO INIT 0. + + + +END PROCEDURE. diff --git a/resources/functionalTests/defineVariable/6-type-tuning/input.p b/resources/functionalTests/defineVariable/6-type-tuning/input.p new file mode 100644 index 0000000..7537e95 --- /dev/null +++ b/resources/functionalTests/defineVariable/6-type-tuning/input.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +DEFINE VARIABLE hColumn AS HANDLE NO-UNDO EXTENT 2. + +DEFINE VARIABLE gcSort AS CHARACTER NO-UNDO INITIAL "dType". +DEFINE VARIABLE gcMods AS CHARACTER NO-UNDO. +DEFINE VARIABLE DigestChecksum AS CHARACTER NO-UNDO. +DEFINE VARIABLE inbuild AS LOGICAL NO-UNDO. +DEFINE VARIABLE derr AS LOGICAL NO-UNDO. diff --git a/resources/functionalTests/defineVariable/6-type-tuning/target.p b/resources/functionalTests/defineVariable/6-type-tuning/target.p new file mode 100644 index 0000000..9ccaa44 --- /dev/null +++ b/resources/functionalTests/defineVariable/6-type-tuning/target.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define VARIABLE hColumn AS HANDLE NO-UNDO EXTENT 2. + +define VARIABLE gcSort AS CHARACTER NO-UNDO INITIAL "dType". +define VARIABLE gcMods AS CHARACTER NO-UNDO. +define VARIABLE DigestChecksum AS CHARACTER NO-UNDO. +define VARIABLE inbuild AS LOGICAL NO-UNDO. +define VARIABLE derr AS LOGICAL NO-UNDO. diff --git a/resources/functionalTests/defineVariable/7-access-tuning/input.p b/resources/functionalTests/defineVariable/7-access-tuning/input.p new file mode 100644 index 0000000..f9be818 --- /dev/null +++ b/resources/functionalTests/defineVariable/7-access-tuning/input.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + + +define public variable mPartitionAfterQuery as handle no-undo. +define private variable ValidDefaultLevelList as char no-undo init "0,1,2". +define protected variable ValidDefaultLevelString as char no-undo init "~"0~" ~"1~" and ~"2~"". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/7-access-tuning/target.p b/resources/functionalTests/defineVariable/7-access-tuning/target.p new file mode 100644 index 0000000..b114fb5 --- /dev/null +++ b/resources/functionalTests/defineVariable/7-access-tuning/target.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + + +define public variable mPartitionAfterQuery as handle no-undo. +define private variable ValidDefaultLevelList as char no-undo init "0,1,2". +define protected variable ValidDefaultLevelString as char no-undo init "~"0~" ~"1~" and ~"2~"". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/7-access-tuning2/input.p b/resources/functionalTests/defineVariable/7-access-tuning2/input.p new file mode 100644 index 0000000..a0e9a3b --- /dev/null +++ b/resources/functionalTests/defineVariable/7-access-tuning2/input.p @@ -0,0 +1,9 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define private variable mCreate as logical no-undo. +define variable mPartitionAfterQuery as handle no-undo. +define private variable ValidTypeList as char no-undo init "Regular,Super". +define private variable ValidTypeString as char no-undo init "~"Regular~" or ~"Super~"". +define private variable ValidDefaultAllocationList as char no-undo init "Immediate,Delayed,None". +define private variable ValidDefaultAllocationString as char no-undo init "~"Immediate~", ~"Delayed~" and ~"None~"". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/7-access-tuning2/target.p b/resources/functionalTests/defineVariable/7-access-tuning2/target.p new file mode 100644 index 0000000..61c7563 --- /dev/null +++ b/resources/functionalTests/defineVariable/7-access-tuning2/target.p @@ -0,0 +1,9 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define private variable mCreate as logical no-undo. +define variable mPartitionAfterQuery as handle no-undo. +define private variable ValidTypeList as char no-undo init "Regular,Super". +define private variable ValidTypeString as char no-undo init "~"Regular~" or ~"Super~"". +define private variable ValidDefaultAllocationList as char no-undo init "Immediate,Delayed,None". +define private variable ValidDefaultAllocationString as char no-undo init "~"Immediate~", ~"Delayed~" and ~"None~"". \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/8-static/input.p b/resources/functionalTests/defineVariable/8-static/input.p new file mode 100644 index 0000000..8459866 --- /dev/null +++ b/resources/functionalTests/defineVariable/8-static/input.p @@ -0,0 +1,11 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define private static var partId AS CHAR INIT ?. +define private static var startRowid AS CHAR. +define public static var intStartRowid AS INT64. +define private static var currRowid AS CHAR. +define protected static vAR intCurrRowid AS INT64. +define private static var intMaxRowid AS INT64. +define private static var partitions AS CHAR EXTENT. +define protected static var currPartitionIx AS INT. \ No newline at end of file diff --git a/resources/functionalTests/defineVariable/8-static/target.p b/resources/functionalTests/defineVariable/8-static/target.p new file mode 100644 index 0000000..c20cbc6 --- /dev/null +++ b/resources/functionalTests/defineVariable/8-static/target.p @@ -0,0 +1,11 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.variableDefinitionFormatting": true} */ + +define private static var partId AS CHAR INIT ?. +define private static var startRowid AS CHAR . +define public static var intStartRowid AS INT64. +define private static var currRowid AS CHAR . +define protected static vAR intCurrRowid AS INT64. +define private static var intMaxRowid AS INT64. +define private static var partitions AS CHAR EXTENT. +define protected static var currPartitionIx AS INT . \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/1parameters/input.p b/resources/functionalTests/procedureParameter/1parameters/input.p new file mode 100644 index 0000000..c786a37 --- /dev/null +++ b/resources/functionalTests/procedureParameter/1parameters/input.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true} */ + +define INPUT PARAMETER cipTitle AS CHARACTER NO-UNDO. +define INPUT-OUTPUT PARAMETER iiopFontNumber AS INTEGER NO-UNDO. +define OUTPUT PARAMETER pressed_OK AS LOGICAL NO-UNDO. +define RETURN PARAMETER uResult as LONG NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/1parameters/target.p b/resources/functionalTests/procedureParameter/1parameters/target.p new file mode 100644 index 0000000..63ade6a --- /dev/null +++ b/resources/functionalTests/procedureParameter/1parameters/target.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true} */ + +define INPUT PARAMETER cipTitle AS CHARACTER NO-UNDO. +define INPUT-OUTPUT PARAMETER iiopFontNumber AS INTEGER NO-UNDO. +define OUTPUT PARAMETER pressed_OK AS LOGICAL NO-UNDO. +define RETURN PARAMETER uResult as LONG NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/2comments-between/input.p b/resources/functionalTests/procedureParameter/2comments-between/input.p new file mode 100644 index 0000000..bd7a494 --- /dev/null +++ b/resources/functionalTests/procedureParameter/2comments-between/input.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +define INPUT PARAMETER pcOptions AS CHARACTER NO-UNDO. +// start +define INPUT-OUTPUT PARAMETER pcHandles AS CHARACTER NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/2comments-between/target.p b/resources/functionalTests/procedureParameter/2comments-between/target.p new file mode 100644 index 0000000..c51d0d1 --- /dev/null +++ b/resources/functionalTests/procedureParameter/2comments-between/target.p @@ -0,0 +1,7 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +define INPUT PARAMETER pcOptions AS CHARACTER NO-UNDO. +// start +define INPUT-OUTPUT PARAMETER pcHandles AS CHARACTER NO-UNDO. \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/2parameters-and-variables/input.p b/resources/functionalTests/procedureParameter/2parameters-and-variables/input.p new file mode 100644 index 0000000..24d6d87 --- /dev/null +++ b/resources/functionalTests/procedureParameter/2parameters-and-variables/input.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +define INPUT PARAMETER relText AS CHARACTER NO-UNDO. +define OUTPUT PARAMETER abortRead AS myReader NO-UNDO. + +define VARIABLE qbf33-2 AS LOGICAL NO-UNDO INIT TRUE. /* dbase-2? */ +define VARIABLE qbf124-c AS CHARACTER NO-UNDO. /* scrap */ +define VARIABLE qbf124124124-i AS INTEGER NO-UNDO. /* scrap */ \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/2parameters-and-variables/target.p b/resources/functionalTests/procedureParameter/2parameters-and-variables/target.p new file mode 100644 index 0000000..57d5423 --- /dev/null +++ b/resources/functionalTests/procedureParameter/2parameters-and-variables/target.p @@ -0,0 +1,10 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +define INPUT PARAMETER relText AS CHARACTER NO-UNDO. +define OUTPUT PARAMETER abortRead AS myReader NO-UNDO. + +define VARIABLE qbf33-2 AS LOGICAL NO-UNDO INIT TRUE. /* dbase-2? */ +define VARIABLE qbf124-c AS CHARACTER NO-UNDO. /* scrap */ +define VARIABLE qbf124124124-i AS INTEGER NO-UNDO. /* scrap */ \ No newline at end of file diff --git a/resources/functionalTests/procedureParameter/3procedure/input.p b/resources/functionalTests/procedureParameter/3procedure/input.p new file mode 100644 index 0000000..80478b7 --- /dev/null +++ b/resources/functionalTests/procedureParameter/3procedure/input.p @@ -0,0 +1,11 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +PROCEDURE addEntry: + define OUTPUT PARAMETER cTableName AS CHARACTER NO-UNDO. + define INPUT PARAMETER p_hidden AS LOGICAL NO-UNDO. + + + +END PROCEDURE. diff --git a/resources/functionalTests/procedureParameter/3procedure/target.p b/resources/functionalTests/procedureParameter/3procedure/target.p new file mode 100644 index 0000000..5682ffb --- /dev/null +++ b/resources/functionalTests/procedureParameter/3procedure/target.p @@ -0,0 +1,11 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.procedureParamaterFormatting": true, + "AblFormatter.variableDefinitionFormatting": true} */ + +PROCEDURE addEntry: + define OUTPUT PARAMETER cTableName AS CHARACTER NO-UNDO. + define INPUT PARAMETER p_hidden AS LOGICAL NO-UNDO. + + + +END PROCEDURE. diff --git a/resources/functionalTests/property/5blocks/input.p b/resources/functionalTests/property/5blocks/input.p index f467d4e..4088e3d 100644 --- a/resources/functionalTests/property/5blocks/input.p +++ b/resources/functionalTests/property/5blocks/input.p @@ -16,7 +16,9 @@ class AClass: END. END SET. - define PRIVATE VARIABLE propertyWidthGetter_ AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter1 AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter2 AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter3 AS SomeClass NO-UNDO. define PROTECTED PROPERTY propertyWidthGetter AS SomeClass NO-UNDO GET(): diff --git a/resources/functionalTests/property/5blocks/target.p b/resources/functionalTests/property/5blocks/target.p index b7521c4..38f9a3c 100644 --- a/resources/functionalTests/property/5blocks/target.p +++ b/resources/functionalTests/property/5blocks/target.p @@ -16,7 +16,9 @@ class AClass: END. END SET. - define PRIVATE VARIABLE propertyWidthGetter_ AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter1 AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter2 AS SomeClass NO-UNDO. + define PRIVATE VARIABLE propertyWidthGetter3 AS SomeClass NO-UNDO. define PROTECTED PROPERTY propertyWidthGetter AS SomeClass NO-UNDO GET(): diff --git a/resources/functionalTests/temptable/3-fields/input.p b/resources/functionalTests/temptable/3-fields/input.p index 1c000d2..f8049f2 100644 --- a/resources/functionalTests/temptable/3-fields/input.p +++ b/resources/functionalTests/temptable/3-fields/input.p @@ -2,10 +2,11 @@ /* { "AblFormatter.temptableFormatting": true, "abl.completion.upperCase": true}*/ -define temp-table ttCustomer no-undo field custNum as integer +DEFINE temp-table ttCustomer no-undo + field custNum as integer field firstName as character - field lastName as character - field birthDate as date - index custNum is primary unique custNum - index firstName firstName - index lastName lastName . + field lastName as character + field birthDate as date + index custNum is primary unique custNum + index firstName firstName + index lastName lastName. \ No newline at end of file diff --git a/resources/functionalTests/temptable/3-fields/target.p b/resources/functionalTests/temptable/3-fields/target.p index 2f893f9..8fbaef6 100644 --- a/resources/functionalTests/temptable/3-fields/target.p +++ b/resources/functionalTests/temptable/3-fields/target.p @@ -3,10 +3,10 @@ "abl.completion.upperCase": true}*/ DEFINE temp-table ttCustomer no-undo - field custNum as integer + field custNum as integer field firstName as character - field lastName as character + field lastName as character field birthDate as date index custNum is primary unique custNum index firstName firstName - index lastName lastName. + index lastName lastName. \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields/input.p b/resources/functionalTests/temptable/4-fields/input.p new file mode 100644 index 0000000..b751de9 --- /dev/null +++ b/resources/functionalTests/temptable/4-fields/input.p @@ -0,0 +1,13 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE IndexDetails +FIELD tblname AS CHARACTER + FIELD idxname AS CHARACTER + FIELD tdesc AS CHARACTER + FIELD lactive AS LOGICAL + FIELD lprimary AS LOGICAL + FIELD lunique AS LOGICAL + FIELD lwordindex AS LOGICAL + FIELD labbrev AS LOGICAL. \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields/target.p b/resources/functionalTests/temptable/4-fields/target.p new file mode 100644 index 0000000..e27fe26 --- /dev/null +++ b/resources/functionalTests/temptable/4-fields/target.p @@ -0,0 +1,13 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE IndexDetails + FIELD tblname AS CHARACTER + FIELD idxname AS CHARACTER + FIELD tdesc AS CHARACTER + FIELD lactive AS LOGICAL + FIELD lprimary AS LOGICAL + FIELD lunique AS LOGICAL + FIELD lwordindex AS LOGICAL + FIELD labbrev AS LOGICAL. \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields2/input.p b/resources/functionalTests/temptable/4-fields2/input.p new file mode 100644 index 0000000..8f70312 --- /dev/null +++ b/resources/functionalTests/temptable/4-fields2/input.p @@ -0,0 +1,12 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE saSys NO-UNDO RCODE-INFORMATION + FIELD dType AS CHARACTER LABEL "Domain Type" FORMAT "x(25)" + FIELD dDescrip AS CHARACTER LABEL "Description" FORMAT "x(65)" + FIELD dDetails AS CHARACTER LABEL "Comments" FORMAT "x(200)" + FIELD dAuthEnabled AS LOGICAL LABEL "Enable Authentication" + FIELD dChecksum AS LOGICAL LABEL "Checksum" + FIELD dCallback AS CHARACTER LABEL "Callback" FORMAT "x(100)". + \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields2/target.p b/resources/functionalTests/temptable/4-fields2/target.p new file mode 100644 index 0000000..f804a2d --- /dev/null +++ b/resources/functionalTests/temptable/4-fields2/target.p @@ -0,0 +1,12 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE saSys NO-UNDO RCODE-INFORMATION + FIELD dType AS CHARACTER LABEL "Domain Type" FORMAT "x(25)" + FIELD dDescrip AS CHARACTER LABEL "Description" FORMAT "x(65)" + FIELD dDetails AS CHARACTER LABEL "Comments" FORMAT "x(200)" + FIELD dAuthEnabled AS LOGICAL LABEL "Enable Authentication" + FIELD dChecksum AS LOGICAL LABEL "Checksum" + FIELD dCallback AS CHARACTER LABEL "Callback" FORMAT "x(100)". + \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields3/input.p b/resources/functionalTests/temptable/4-fields3/input.p new file mode 100644 index 0000000..e1b6c76 --- /dev/null +++ b/resources/functionalTests/temptable/4-fields3/input.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE tAction NO-UNDO + FIELD Name AS CHAR + FIELD Hdl AS HANDLE + FIELD RectHdl AS HANDLE + FIELD DivideHdl AS HANDLE + FIELD TxtHdl AS HANDLE + FIELD Sort1 AS INT + FIELD Sort2 AS INT + FIELD Link AS CHAR + FIELD Menu AS LOG + FIELD Tool AS LOG + INDEX Sort AS PRIMARY sort1 sort2. \ No newline at end of file diff --git a/resources/functionalTests/temptable/4-fields3/target.p b/resources/functionalTests/temptable/4-fields3/target.p new file mode 100644 index 0000000..18aa0b7 --- /dev/null +++ b/resources/functionalTests/temptable/4-fields3/target.p @@ -0,0 +1,16 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE tAction NO-UNDO + FIELD Name AS CHAR + FIELD Hdl AS HANDLE + FIELD RectHdl AS HANDLE + FIELD DivideHdl AS HANDLE + FIELD TxtHdl AS HANDLE + FIELD Sort1 AS INT + FIELD Sort2 AS INT + FIELD Link AS CHAR + FIELD Menu AS LOG + FIELD Tool AS LOG + INDEX Sort AS PRIMARY sort1 sort2. \ No newline at end of file diff --git a/resources/functionalTests/temptable/7-fields-two-tables/input.p b/resources/functionalTests/temptable/7-fields-two-tables/input.p new file mode 100644 index 0000000..05daea6 --- /dev/null +++ b/resources/functionalTests/temptable/7-fields-two-tables/input.p @@ -0,0 +1,25 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE tDataSource +FIELD TargetProc AS HANDLE +FIELD DataSource AS HANDLE +FIELD ObjectName AS CHAR +FIELD DocumentPath AS CHAR /* Consumer only */ +FIELD Commit AS LOG +INDEX DataSource AS UNIQUE TargetProc DataSource + INDEX ObjectName ObjectName TargetProc + INDEX DocumentPath DocumentPath TargetProc + INDEX Commit TargetProc Commit. + +/** Producer temp-tables **/ +/* Register all datasource/methods that update nodes with out parameters */ +DEFINE TEMP-TABLE tMethodNode +FIELD TargetProc AS HANDLE + FIELD DataSource AS HANDLE + FIELD Method AS CHAR + FIELD MethodNode AS DEC +FIELD NumParam AS INT + INDEX Method AS UNIQUE TargetProc DataSource Method + INDEX Node TargetProc MethodNode. \ No newline at end of file diff --git a/resources/functionalTests/temptable/7-fields-two-tables/target.p b/resources/functionalTests/temptable/7-fields-two-tables/target.p new file mode 100644 index 0000000..1f8b9f7 --- /dev/null +++ b/resources/functionalTests/temptable/7-fields-two-tables/target.p @@ -0,0 +1,25 @@ +/* formatterSettingsOverride */ +/* { "AblFormatter.temptableFormatting": true, + "abl.completion.upperCase": true}*/ + +DEFINE TEMP-TABLE tDataSource + FIELD TargetProc AS HANDLE + FIELD DataSource AS HANDLE + FIELD ObjectName AS CHAR + FIELD DocumentPath AS CHAR /* Consumer only */ + FIELD Commit AS LOG + INDEX DataSource AS UNIQUE TargetProc DataSource + INDEX ObjectName ObjectName TargetProc + INDEX DocumentPath DocumentPath TargetProc + INDEX Commit TargetProc Commit. + +/** Producer temp-tables **/ +/* Register all datasource/methods that update nodes with out parameters */ +DEFINE TEMP-TABLE tMethodNode + FIELD TargetProc AS HANDLE + FIELD DataSource AS HANDLE + FIELD Method AS CHAR + FIELD MethodNode AS DEC + FIELD NumParam AS INT + INDEX Method AS UNIQUE TargetProc DataSource Method + INDEX Node TargetProc MethodNode. \ No newline at end of file diff --git a/src/model/SyntaxNodeType.ts b/src/model/SyntaxNodeType.ts index 44e1fb1..3eb4f61 100644 --- a/src/model/SyntaxNodeType.ts +++ b/src/model/SyntaxNodeType.ts @@ -22,6 +22,7 @@ export enum SyntaxNodeType { FieldDefinition = "field_definition", IndexDefinition = "index_definition", VariableDefinition = "variable_definition", + ProcedureParameterDefinition = "procedure_parameter_definition", VariableAssignment = "variable_assignment", ConstructorDefinition = "constructor_definition", DestructorDefinition = "destructor_definition", @@ -56,6 +57,9 @@ export enum SyntaxNodeType { EnumStatement = "enum_statement", EnumMember = "enum_member", EnumDefinition = "enum_definition", + TypeTuning = "type_tuning", + AccessTuning = "access_tuning", + Comment = "comment", Getter = "getter", Setter = "setter", LeftParenthesis = "(", @@ -95,6 +99,13 @@ export enum SyntaxNodeType { DefineKeyword = "DEFINE", DefiKeyword = "DEFI", DefKeyword = "DEF", + NoUndoKeyword = "NO-UNDO", + InputKeyword = "INPUT", + OutputKeyword = "OUTPUT", + InputOutputKeyword = "INPUT-OUTPUT", + ReturnKeyword = "RETURN", + ParameterKeyword = "PARAMETER", + VariableKeyword = "VARIABLE", } export const afterThenStatements = new MyFancySet([ @@ -118,3 +129,10 @@ export const bodyBlockKeywords = new MyFancySet([ SyntaxNodeType.ClassBody, SyntaxNodeType.InterfaceBody, ]); + +export const parameterTypes = new MyFancySet([ + SyntaxNodeType.InputKeyword, + SyntaxNodeType.OutputKeyword, + SyntaxNodeType.InputOutputKeyword, + SyntaxNodeType.ReturnKeyword, +]); diff --git a/src/utils/ConfigurationManager.ts b/src/utils/ConfigurationManager.ts index 0d0733b..e1b0922 100644 --- a/src/utils/ConfigurationManager.ts +++ b/src/utils/ConfigurationManager.ts @@ -15,12 +15,16 @@ export class ConfigurationManager2 implements IConfigurationManager { workspace.onDidChangeConfiguration((e) => { if (e.affectsConfiguration("AblFormatter")) { this.reloadConfig = true; - window.showInformationMessage("ABL Formatter was changed2!"); + window.showInformationMessage( + "ABL Formatter settings were changed!" + ); } if (e.affectsConfiguration("abl.completion")) { this.reloadExternalConfig = true; - window.showInformationMessage("ABL cassing was changed2!"); + window.showInformationMessage( + "ABL completion settings were changed!" + ); } }); } diff --git a/src/v2/formatterFramework/enableFormatterDecorators.ts b/src/v2/formatterFramework/enableFormatterDecorators.ts index 57b074c..e18aa16 100644 --- a/src/v2/formatterFramework/enableFormatterDecorators.ts +++ b/src/v2/formatterFramework/enableFormatterDecorators.ts @@ -11,6 +11,8 @@ import { TempTableFormatter } from "../formatters/tempTable/TempTableFormatter"; import { PropertyFormatter } from "../formatters/property/PropertyFormatter"; import { BodyFormatter } from "../formatters/body/BodyFormatter"; import { EnumFormatter } from "../formatters/enum/EnumFormatter"; +import { VariableDefinitionFormatter } from "../formatters/variableDefinition/VariableDefinitionFormatter"; +import { ProcedureParameterFormatter } from "../formatters/procedureParameter/ProcedureParameterFormatter"; // 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 { @@ -26,5 +28,7 @@ export function enableFormatterDecorators(): void { TempTableFormatter; PropertyFormatter; IfFunctionFormatter; + VariableDefinitionFormatter; EnumFormatter; + ProcedureParameterFormatter; } diff --git a/src/v2/formatters/procedureParameter/ProcedureParameterFormatter.ts b/src/v2/formatters/procedureParameter/ProcedureParameterFormatter.ts new file mode 100644 index 0000000..bf15e30 --- /dev/null +++ b/src/v2/formatters/procedureParameter/ProcedureParameterFormatter.ts @@ -0,0 +1,213 @@ +import { SyntaxNode } from "web-tree-sitter"; +import { RegisterFormatter } from "../../formatterFramework/formatterDecorator"; +import { IFormatter } from "../../formatterFramework/IFormatter"; +import { CodeEdit } from "../../model/CodeEdit"; +import { FullText } from "../../model/FullText"; +import { AFormatter } from "../AFormatter"; +import { + definitionKeywords, + parameterTypes, + SyntaxNodeType, +} from "../../../model/SyntaxNodeType"; +import { ProcedureParameterSettings } from "./ProcedureParameterSettings"; +import { IConfigurationManager } from "../../../utils/IConfigurationManager"; +import { FormatterHelper } from "../../formatterFramework/FormatterHelper"; + +@RegisterFormatter +export class ProcedureParameterFormatter + extends AFormatter + implements IFormatter +{ + public static readonly formatterLabel = "procedureParamaterFormatting"; + private readonly settings: ProcedureParameterSettings; + private static visitedNodes: Set = new Set(); + private static alignType = 0; + private static alignNoUndo = 0; + private static alignParameter = 0; + + public constructor(configurationManager: IConfigurationManager) { + super(configurationManager); + this.settings = new ProcedureParameterSettings(configurationManager); + } + + match(node: Readonly): boolean { + if (node.type === SyntaxNodeType.ProcedureParameterDefinition) { + return true; + } + return false; + } + parse( + node: Readonly, + fullText: Readonly + ): CodeEdit | CodeEdit[] | undefined { + const oldText = FormatterHelper.getCurrentText(node, fullText); + if (ProcedureParameterFormatter.visitedNodes.has(node.id)) { + const newText = this.collectString(node, fullText); + return this.getCodeEdit(node, oldText, newText, fullText); + } + + this.resetStaticVariables(); + let currentNode: SyntaxNode | null = node; + for ( + currentNode; + currentNode !== null; + currentNode = currentNode.nextSibling + ) { + if (currentNode.type === SyntaxNodeType.Comment) { + continue; + } + if ( + currentNode.type !== SyntaxNodeType.ProcedureParameterDefinition + ) { + break; + } + this.collectStructure(currentNode, fullText); + ProcedureParameterFormatter.visitedNodes.add(currentNode.id); + } + const newText = this.collectString(node, fullText); + return this.getCodeEdit(node, oldText, newText, fullText); + } + + private collectString( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + node.children.forEach((child) => { + resultString = resultString.concat(this.getString(child, fullText)); + }); + resultString += "."; + return resultString; + } + + private collectStructure( + node: SyntaxNode, + fullText: Readonly + ): void { + node.children.forEach((child) => { + this.getStructure(child, fullText); + }); + } + + private getStructure(node: SyntaxNode, fullText: Readonly): void { + switch (node.type) { + case SyntaxNodeType.TypeTuning: + ProcedureParameterFormatter.alignNoUndo = Math.max( + ProcedureParameterFormatter.alignNoUndo, + this.collectTypeTuningString(node, fullText).length + ); + break; + case SyntaxNodeType.Identifier: + ProcedureParameterFormatter.alignType = Math.max( + ProcedureParameterFormatter.alignType, + FormatterHelper.getCurrentText(node, fullText).trim().length + ); + break; + case parameterTypes.hasFancy(node.type, ""): + ProcedureParameterFormatter.alignParameter = Math.max( + ProcedureParameterFormatter.alignParameter, + FormatterHelper.getCurrentText(node, fullText).trim().length + ); + break; + } + } + + private getString(node: SyntaxNode, fullText: Readonly): string { + let newString = ""; + switch (node.type) { + case SyntaxNodeType.DotKeyword: + break; + case definitionKeywords.hasFancy(node.type, ""): + newString = FormatterHelper.getCurrentText( + node, + fullText + ).trimEnd(); + break; + case SyntaxNodeType.TypeTuning: + const typeTuningText = this.collectTypeTuningString( + node, + fullText + ); + newString = + typeTuningText + + " ".repeat( + ProcedureParameterFormatter.alignNoUndo - + typeTuningText.length + ); + break; + case SyntaxNodeType.Identifier: + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = + " " + + text + + " ".repeat( + ProcedureParameterFormatter.alignType - text.length + ); + break; + case parameterTypes.hasFancy(node.type, ""): { + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = + " " + + text + + " ".repeat( + ProcedureParameterFormatter.alignParameter - text.length + ); + break; + } + case SyntaxNodeType.Error: + newString = FormatterHelper.getCurrentText(node, fullText); + break; + default: { + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = text.length === 0 ? "" : " " + text; + break; + } + } + return newString; + } + + private collectTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + node.children.forEach((child) => { + resultString = resultString.concat( + this.getTypeTuningString(child, fullText) + ); + }); + return resultString; + } + + private getTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + const text = FormatterHelper.getCurrentText(node, fullText).trim(); + switch (node.type) { + case SyntaxNodeType.Error: + newString = FormatterHelper.getCurrentText(node, fullText); + break; + default: + newString = text.length === 0 ? "" : " " + text; + break; + } + return newString; + } + + private resetStaticVariables() { + ProcedureParameterFormatter.alignType = 0; + ProcedureParameterFormatter.alignNoUndo = 0; + ProcedureParameterFormatter.alignParameter = 0; + } +} diff --git a/src/v2/formatters/procedureParameter/ProcedureParameterSettings.ts b/src/v2/formatters/procedureParameter/ProcedureParameterSettings.ts new file mode 100644 index 0000000..f75b610 --- /dev/null +++ b/src/v2/formatters/procedureParameter/ProcedureParameterSettings.ts @@ -0,0 +1,8 @@ +import { ASettings } from "../ASettings"; + +export class ProcedureParameterSettings extends ASettings { + // procedure parameter settings + public procedureParameterFormatting() { + return !!this.configurationManager.get("procedureParamaterFormatting"); + } +} diff --git a/src/v2/formatters/tempTable/TempTableFormatter.ts b/src/v2/formatters/tempTable/TempTableFormatter.ts index 6ec33ec..9ac5558 100644 --- a/src/v2/formatters/tempTable/TempTableFormatter.ts +++ b/src/v2/formatters/tempTable/TempTableFormatter.ts @@ -16,7 +16,7 @@ import { export class TempTableFormatter extends AFormatter implements IFormatter { public static readonly formatterLabel = "temptableFormatting"; private readonly settings: TempTableSettings; - + private alignType = 0; private startColumn = 0; private temptableValueColumn = 0; private temptableBodyValue = ""; @@ -36,13 +36,13 @@ export class TempTableFormatter extends AFormatter implements IFormatter { node: Readonly, fullText: Readonly ): CodeEdit | CodeEdit[] | undefined { - const text = FormatterHelper.getCurrentText(node, fullText); - this.collectTemptableStructure(node, fullText); + const text = FormatterHelper.getCurrentText(node, fullText); + this.collectTemptableString(node, fullText); return this.getCodeEdit(node, text, this.temptableBodyValue, fullText); } - private collectTemptableStructure(node: SyntaxNode, fullText: FullText) { + private collectTemptableString(node: SyntaxNode, fullText: FullText) { this.startColumn = FormatterHelper.getActualStatementIndentation( node, fullText @@ -71,6 +71,101 @@ export class TempTableFormatter extends AFormatter implements IFormatter { return resultString; } + private collectTemptableStructure( + node: SyntaxNode, + fullText: Readonly + ): void { + node.children.forEach((child) => { + this.getTemptableStructure(child, fullText); + }); + } + + private getTemptableStructure(node: SyntaxNode, fullText: FullText): void { + switch (node.type) { + case SyntaxNodeType.FieldDefinition: + node.children.forEach((child) => { + this.getFieldStructure(child, fullText); + }); + break; + } + } + + private getFieldStructure(node: SyntaxNode, fullText: FullText): void { + switch (node.type) { + case SyntaxNodeType.Identifier: + this.alignType = Math.max( + this.alignType, + FormatterHelper.getCurrentText(node, fullText).trim().length + ); + break; + } + } + + private collectFieldString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + node.children.forEach((child) => { + newString = newString.concat(this.getFieldString(child, fullText)); + }); + return newString; + } + + private getFieldString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + const text = FormatterHelper.getCurrentText(node, fullText).trim(); + switch (node.type) { + case SyntaxNodeType.FieldKeyword: + newString = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + break; + case SyntaxNodeType.TypeTuning: + newString = this.collectTypeTuningString(node, fullText); + break; + case SyntaxNodeType.Identifier: + newString = + " " + text + " ".repeat(this.alignType - text.length); + break; + default: + newString = text.length === 0 ? "" : " " + text; + break; + } + return newString; + } + + private collectTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + node.children.forEach((child) => { + resultString = resultString.concat( + this.getTypeTuningString(child, fullText) + ); + }); + return resultString; + } + + private getTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + const text = FormatterHelper.getCurrentText(node, fullText).trim(); + switch (node.type) { + default: + newString = text.length === 0 ? "" : " " + text; + break; + } + return newString; + } + private getTemptableExpressionString( node: SyntaxNode, separator: string, @@ -83,6 +178,8 @@ export class TempTableFormatter extends AFormatter implements IFormatter { newString = FormatterHelper.getCurrentText(node, fullText); break; case SyntaxNodeType.FieldDefinition: + newString = separator + this.collectFieldString(node, fullText); + break; case SyntaxNodeType.IndexDefinition: node.children.forEach((child) => { newString = newString.concat( diff --git a/src/v2/formatters/variableDefinition/VariableDefinitionFormatter.ts b/src/v2/formatters/variableDefinition/VariableDefinitionFormatter.ts new file mode 100644 index 0000000..f893b11 --- /dev/null +++ b/src/v2/formatters/variableDefinition/VariableDefinitionFormatter.ts @@ -0,0 +1,246 @@ +import { SyntaxNode } from "web-tree-sitter"; +import { RegisterFormatter } from "../../formatterFramework/formatterDecorator"; +import { IFormatter } from "../../formatterFramework/IFormatter"; +import { CodeEdit } from "../../model/CodeEdit"; +import { FullText } from "../../model/FullText"; +import { AFormatter } from "../AFormatter"; +import { + definitionKeywords, + SyntaxNodeType, +} from "../../../model/SyntaxNodeType"; +import { VariableDefinitionSettings } from "./VariableDefinitionSettings"; +import { IConfigurationManager } from "../../../utils/IConfigurationManager"; +import { FormatterHelper } from "../../formatterFramework/FormatterHelper"; + +@RegisterFormatter +export class VariableDefinitionFormatter + extends AFormatter + implements IFormatter +{ + public static readonly formatterLabel = "variableDefinitionFormatting"; + private readonly settings: VariableDefinitionSettings; + private static visitedNodes: Set = new Set(); + private static alignType = 0; + private static alignNoUndo = 0; + private static alignVariableKeyword = 0; + private hasAccessTuning = false; + + public constructor(configurationManager: IConfigurationManager) { + super(configurationManager); + this.settings = new VariableDefinitionSettings(configurationManager); + } + + match(node: Readonly): boolean { + if (node.type === SyntaxNodeType.VariableDefinition) { + return true; + } + return false; + } + parse( + node: Readonly, + fullText: Readonly + ): CodeEdit | CodeEdit[] | undefined { + const oldText = FormatterHelper.getCurrentText(node, fullText); + this.resetNodeVariables(); + + if (VariableDefinitionFormatter.visitedNodes.has(node.id)) { + const newText = this.collectDefineString(node, fullText); + return this.getCodeEdit(node, oldText, newText, fullText); + } + + this.resetStaticVariables(); + let currentNode: SyntaxNode | null = node; + for ( + currentNode; + currentNode !== null; + currentNode = currentNode.nextSibling + ) { + if (currentNode.type === SyntaxNodeType.Comment) { + continue; + } + if (currentNode.type !== SyntaxNodeType.VariableDefinition) { + break; + } + this.collectDefineStructure(currentNode, fullText); + VariableDefinitionFormatter.visitedNodes.add(currentNode.id); + } + const newText = this.collectDefineString(node, fullText); + return this.getCodeEdit(node, oldText, newText, fullText); + } + + private collectDefineString( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + node.children.forEach((child) => { + resultString = resultString.concat( + this.getExpressionString(child, fullText) + ); + }); + resultString += "."; + return resultString; + } + + private collectDefineStructure( + node: SyntaxNode, + fullText: Readonly + ): void { + node.children.forEach((child) => { + this.getDefineStructure(child, fullText); + }); + } + + private getDefineStructure( + node: SyntaxNode, + fullText: Readonly + ): void { + switch (node.type) { + case SyntaxNodeType.TypeTuning: + VariableDefinitionFormatter.alignNoUndo = Math.max( + VariableDefinitionFormatter.alignNoUndo, + this.collectTypeTuningString(node, fullText).length + ); + break; + case SyntaxNodeType.Identifier: + VariableDefinitionFormatter.alignType = Math.max( + VariableDefinitionFormatter.alignType, + FormatterHelper.getCurrentText(node, fullText).trim().length + ); + break; + case SyntaxNodeType.AccessTuning: + VariableDefinitionFormatter.alignVariableKeyword = Math.max( + VariableDefinitionFormatter.alignVariableKeyword, + FormatterHelper.getCurrentText(node, fullText).trim().length + ); + break; + } + } + + private getExpressionString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + switch (node.type) { + case SyntaxNodeType.DotKeyword: + break; + case definitionKeywords.hasFancy(node.type, ""): + newString = FormatterHelper.getCurrentText( + node, + fullText + ).trimEnd(); + break; + case SyntaxNodeType.TypeTuning: + const typeTuningText = this.collectTypeTuningString( + node, + fullText + ); + newString = + typeTuningText + + " ".repeat( + VariableDefinitionFormatter.alignNoUndo - + typeTuningText.length + ); + break; + case SyntaxNodeType.AccessTuning: { + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = + " " + + text + + " ".repeat( + VariableDefinitionFormatter.alignVariableKeyword - + text.length + ); + this.hasAccessTuning = true; + break; + } + case SyntaxNodeType.VariableKeyword: { + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + if ( + !this.hasAccessTuning && + VariableDefinitionFormatter.alignVariableKeyword !== 0 + ) { + newString = + " ".repeat( + 2 + VariableDefinitionFormatter.alignVariableKeyword + ) + text; + this.hasAccessTuning = true; + } else { + newString = " " + text; + } + break; + } + case SyntaxNodeType.Identifier: + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = + " " + + text + + " ".repeat( + VariableDefinitionFormatter.alignType - text.length + ); + break; + case SyntaxNodeType.Error: + newString = FormatterHelper.getCurrentText(node, fullText); + break; + default: { + const text = FormatterHelper.getCurrentText( + node, + fullText + ).trim(); + newString = text.length === 0 ? "" : " " + text; + break; + } + } + return newString; + } + + private collectTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let resultString = ""; + node.children.forEach((child) => { + resultString = resultString.concat( + this.getTypeTuningString(child, fullText) + ); + }); + return resultString; + } + + private getTypeTuningString( + node: SyntaxNode, + fullText: Readonly + ): string { + let newString = ""; + const text = FormatterHelper.getCurrentText(node, fullText).trim(); + switch (node.type) { + case SyntaxNodeType.Error: + newString = FormatterHelper.getCurrentText(node, fullText); + break; + default: + newString = text.length === 0 ? "" : " " + text; + break; + } + return newString; + } + + private resetNodeVariables() { + this.hasAccessTuning = false; + } + + private resetStaticVariables() { + VariableDefinitionFormatter.alignType = 0; + VariableDefinitionFormatter.alignNoUndo = 0; + VariableDefinitionFormatter.alignVariableKeyword = 0; + } +} diff --git a/src/v2/formatters/variableDefinition/VariableDefinitionSettings.ts b/src/v2/formatters/variableDefinition/VariableDefinitionSettings.ts new file mode 100644 index 0000000..9b725f2 --- /dev/null +++ b/src/v2/formatters/variableDefinition/VariableDefinitionSettings.ts @@ -0,0 +1,8 @@ +import { ASettings } from "../ASettings"; + +export class VariableDefinitionSettings extends ASettings { + // variable definition settings + public variableDefinitionFormatting() { + return !!this.configurationManager.get("variableDefinitionFormatting"); + } +}