Skip to content

Commit

Permalink
Add UsePackageClause config
Browse files Browse the repository at this point in the history
  • Loading branch information
CKMonika committed Feb 16, 2024
1 parent 1e314d0 commit 062a32f
Show file tree
Hide file tree
Showing 21 changed files with 908 additions and 0 deletions.
55 changes: 55 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,61 @@
]
}
},
"UsePackageClause": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "use"
},
"whitespace",
{
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_packages"
}
},
{
"kind": "text",
"text": ";"
}
]
}
},
"UseTypeClause": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "use"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_has_all"
},
{
"kind": "text",
"text": "type"
},
"whitespace",
{
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_types"
}
},
{
"kind": "text",
"text": ";"
}
]
}
},
"NameList":{
"sep":["recurse", "line"]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"id": 27,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 26,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "use "
},
{
"id": 24,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 23,
"kind": "list",
"list": [
{
"id": 9,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 8,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 1,
"kind": "text",
"text": "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
{
"id": 2,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 3,
"kind": "text",
"text": ".Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 5,
"kind": "text",
"text": ".Ccccccccccccccccccccccccccccccccccccc"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
}
},
{
"id": 10,
"kind": "text",
"text": ","
},
{
"id": 11,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 12,
"kind": "text",
"text": "Dddddddddddddd,"
},
{
"id": 13,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 14,
"kind": "text",
"text": "Eeeeeeeeeeeeeee,"
},
{
"id": 15,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 22,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 21,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 20,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 19,
"kind": "list",
"list": [
{
"id": 16,
"kind": "text",
"text": "FFFFFFFF"
},
{
"id": 17,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 18,
"kind": "text",
"text": ".Gggggggggggggg"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
}
}
]
}
}
},
{
"id": 25,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa .Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb. Ccccccccccccccccccccccccccccccccccccc , Dddddddddddddd, Eeeeeeeeeeeeeee, FFFFFFFF.Gggggggggggggg;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
.Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
.Ccccccccccccccccccccccccccccccccccccc,
Dddddddddddddd,
Eeeeeeeeeeeeeee,
FFFFFFFF.Gggggggggggggg;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
description: |
This test checks the formatting of a use package clause having
a list of package names exceeding the maximal line length.
The packages are designated by dotted and simple names with
different casing.
It is expected to break after the comma, align on the first
element of the package list and keep the casing unchanged.
The long dotted name will be formatted as expected (namely, a
line break is inserted before . and the alignment is based on
the initial position of the first field and a line continuation
indentation (i.e., 2 spaces) is added before . on each new line.
driver: unparser
rule: use_clause
Loading

0 comments on commit 062a32f

Please sign in to comment.