-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix indentation when formatting text blocks
Updates the formatter to indent the node value of a node kvp when they are text blocks. A test case was added for a text block as the node value of a node kvp, and a test case was updated for when text blocks are in traits.
- Loading branch information
1 parent
1fdd79b
commit 69209ea
Showing
5 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.../test/resources/software/amazon/smithy/syntax/formatter/node-text-blocks.formatted.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$version: "2.0" | ||
|
||
metadata validators = [ | ||
{ | ||
name: "EmitEachSelector" | ||
id: "MissingStringInputLengthValidation" | ||
severity: "DANGER" | ||
message: "This string is missing required length trait" | ||
configuration: { | ||
selector: """ | ||
operation -[input]-> structure > member | ||
:test(member > string:not([trait|enum])) | ||
:test(member > string:not([trait|length])) | ||
:test(member > string:not([trait|aws.api#arnReference])) | ||
:test(member > string:not([trait|aws.api#providesPassRole])) | ||
""" | ||
} | ||
} | ||
] | ||
|
||
namespace smithy.example |
21 changes: 21 additions & 0 deletions
21
...syntax/src/test/resources/software/amazon/smithy/syntax/formatter/node-text-blocks.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$version: "2.0" | ||
|
||
metadata validators = [ | ||
{ | ||
name: "EmitEachSelector" | ||
id: "MissingStringInputLengthValidation" | ||
severity: "DANGER" | ||
message: "This string is missing required length trait" | ||
configuration: { | ||
selector: """ | ||
operation -[input]-> structure > member | ||
:test(member > string:not([trait|enum])) | ||
:test(member > string:not([trait|length])) | ||
:test(member > string:not([trait|aws.api#arnReference])) | ||
:test(member > string:not([trait|aws.api#providesPassRole])) | ||
""" | ||
} | ||
} | ||
] | ||
|
||
namespace smithy.example |
26 changes: 26 additions & 0 deletions
26
...c/test/resources/software/amazon/smithy/syntax/formatter/trait-textblock.formatted.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
@documentation( | ||
""" | ||
This is the documentation for Foo. | ||
Lorem ipsum dolor.""" | ||
) | ||
string Foo | ||
|
||
@documentation( | ||
""" | ||
This is the documentation for Bar. | ||
Lorem ipsum dolor. | ||
""" | ||
) | ||
string Bar | ||
|
||
@documentation( | ||
""" | ||
This is the documentation for Baz. | ||
Lorem ipsum dolor. | ||
""" | ||
) | ||
string Baz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters