Skip to content

Commit

Permalink
Merge pull request #257 from BalticAmadeus/develop
Browse files Browse the repository at this point in the history
0.0.2 release
  • Loading branch information
PauliusKu authored Oct 18, 2024
2 parents 76d0e3e + 36dffe8 commit a4c9802
Show file tree
Hide file tree
Showing 255 changed files with 3,182 additions and 548 deletions.
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ vsc-extension-quickstart.md
node_modules/**
resources/functionalTests/**
resources/samples/**
resources/treeSitterErrorTests/**
resources/ade
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Baltic Amadeus, UAB

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
95 changes: 69 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,71 @@
# AblFormatter

VSCode extension for Progress OpenEdge code formatting

## Feature Summary

Already implemented:
- Block
- Assign
- Define

| | Feature | Default value | Values | Code example |
|--|---------|---------------|-----------------|--------------|
| | tabSize | 4 | Number | |
| | assignFormatting | true | Boolean | |
| | assignFormattingAssignLocation | New | New, Same | |
| | assignFormattingAlignRightExpression | Yes | Yes, No | |
| | assignFormattingEndDotLocation | New aligned | New, New aligned, Same | |
| | defineFormatting | true | Boolean | |
| | findFormatting | true | Boolean | |
| | forFormatting | true | Boolean | |
| | caseFormatting | true | Boolean | |
| | blockFormatting | true | Boolean | |
| | ifFormatting | true | Boolean | |
| | ifFormattingThenLocation | Same | New, Same | `if true then return a.` <br> ⬇️ <br> `if true`<br>`then return a.` |
| | ifFormattingDoLocation | Same | New, Same | `if true then do:`<br>` return a.`<br>`end.` <br> ⬇️ <br> `if true then`<br>`do:`<br>` return a.`<br>`end.` |
| | ifFormattingStatementLocation | Same | New, Same | `if true then return a.` <br> ⬇️ <br> `if true then`<br>` return a.` |
| | temptableFormatting | true | Boolean | |
VSCode extension for Progress OpenEdge code formatting.

This extension uses tree-sitter-abl implementation by Kamil Jakubus. TODO: add links

## Current status

This is an early preview. Currently, the formatter is not ready for the public release. You can only download it here and install from **vsix** file. In a few months we should be able to release it to the marketplaces.

TODO: Add gif here

## Features

At the moment we implemented formatting logic for these language features:

- Code blocks
- ASSIGN
- CASE
- DEFINE
- FOR
- IF statement
- IF function
- USING

## Configuration

We implemented extensive settings configuration to allow users to easly tailor the experience to their needs. This might not be the case in the future.

TODO: link a separate file with settings

## Installation

Download the extension **vsix** file from GitHub repository and install it on your machine.

[How to install from **vsix**?](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix)

## Usage

Alowed file extensions:

- **.p**
- **.cls**
- **.i**
- **.w**

Commands:

- **Format Document**: Formats the entire ABL document.
- **Format Selection**: Formats only the selected lines of code.

## Debuging

- TODO: describe how to deal with debug mode

## Contributing

### Registering formatter issues

- TODO: create issue template

### Fixing yourself

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Commit your changes and push to your branch.
4. Submit a pull request to the main repository.

## License

This project is licensed under the APACHE 2.0 License - see the LICENSE file for details.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 39 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "AblFormatter",
"displayName": "AblFormatter",
"description": "TODO",
"version": "0.0.1",
"repository": {},
"name": "abl-formatter",
"displayName": "Abl Formatter",
"description": "Progress OpenEdge (ABL) code formatter",
"version": "0.0.2",
"icon": "resources/Formatter_LOGO.png",
"repository": {
"url": "https://github.com/BalticAmadeus/AblFormatter"
},
"engines": {
"vscode": "^1.84.0"
},
Expand Down Expand Up @@ -180,11 +183,11 @@
"default": "true",
"description": "Enable USING formatting"
},
"AblFormatter.emptyBlockFormatting": {
"AblFormatter.bodyFormatting": {
"order": 1000,
"type": "boolean",
"default": "true",
"description": "Enable EMPTY BLOCK formatting"
"description": "Enable BODY formatting"
},
"AblFormatter.propertyFormatting": {
"order": 1100,
Expand All @@ -201,7 +204,7 @@
"AblFormatter.ifFunctionFormattingAddParentheses": {
"order": 1201,
"type": "string",
"default": "Yes",
"default": "No",
"enum": [
"Yes",
"No"
Expand All @@ -218,20 +221,41 @@
],
"description": "Add a new line before the ELSE?"
},
"AblFormatter.enumFormatting": {
"order": 1300,
"type": "boolean",
"default": "true",
"description": "Enable ENUM formatting"
},
"AblFormatter.enumFormattingEndDotLocation": {
"order": 1301,
"type": "string",
"default": "Same",
"enum": [
"New",
"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",
"default": "true",
"description": "Enable table view with tree info on hover"
}
}
},
"commands": [
{
"command": "AblFormatter.helloWorld",
"title": "Hello World"
}
]
}
},
"scripts": {
"copy-wasm": "copyfiles -u 2 ./node_modules/web-tree-sitter/*.wasm out",
Expand Down
Binary file added resources/Formatter_LOGO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
.
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Original file line number Diff line number Diff line change
Expand Up @@ -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
.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 0 additions & 4 deletions resources/functionalTests/assign/15assign-noError/input.p
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions resources/functionalTests/assign/15assign-noError/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions resources/functionalTests/assign/16assign-When/input.p
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions resources/functionalTests/assign/16assign-When/target.p
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
.
Loading

0 comments on commit a4c9802

Please sign in to comment.