Suggestion: Allow same-line for assignment
Describe the Feature
We use settings to put braces on the next line, but I think it would be nice to have a setting to allow assignment brackets to be on the same.
For example:
class Main
{
static function main()
{
var object = {
field: 100
};
}
}
The current output seems a little strange?
class Main
{
static function main()
{
var object =
{
field: 100
};
}
}
Perhaps there should be an option to not indent the assignment as well?
The current output seems a little strange?
I agree, I wonder if that's just a bug / related to https://github.com/HaxeCheckstyle/haxe-formatter/issues/315.
Perhaps there should be an option to not indent the assignment as well?
Should probably be the default behavior, actually.
Here's a slightly different version of this for the unit tests:
class Main
{
static function main()
{
return [
{
"name": "Lime",
"type": "lime",
"request": "launch"
}];
}
}
{
"lineEnds": {
"leftCurly": "both"
}
}
I have an additional use case for this request: anonymous types
function polarToRec(r:Float, theta:Float):{
x:Float,
y:Float
}
{
return ...
}
Typedefs too, although this could be considered as similar to an assignment
typedef Point = {
x:Float,
y:Float
}
@jgranick The 1.7.0 release addresses half of this issue, you can now achieve this formatting:
class Main
{
static function main()
{
var object = {
field: 100
};
}
}
With the following config:
{
"lineEnds": {
"leftCurly": "both",
"objectLiteralCurly": {
"leftCurly": "after"
}
}
}