Skip to content

v2.4.0

Choose a tag to compare

@Janther Janther released this 05 Aug 05:58
· 76 commits to main since this release
dd92d2d

What's Changed

Better Tests

Format changes

  • Member access chained expressions now can have comments in the middle of the chain placed properly by @Janther in #1461
// Unformatted
contract Foo {
    function bar() public {
// Comments in between the chain
        game.
// CONFIG
// Do not touch
config. // Window
// Resolution 1000
resolveWindow = 1000;

begin
    .// Comment 1
    functionCall(/* Comment about parameter */ parameter)
    .// Comment 2
    end;
    }
}

// prettier-plugin-solidity 2.4.0
contract Foo {
    function bar() public {
        // Comments in between the chain
        game
        // CONFIG
        // Do not touch
            .config // Window
            // Resolution 1000
            .resolveWindow = 1000;

        begin // Comment 1
            .functionCall(/* Comment about parameter */ parameter) // Comment 2
            .end;
    }
}
  • Avoid printing a lingering line when there is no iterator by @Janther in #1630
// Original
contract Foo {
    function bar() public {
        for (initialize;;) {}
        for (; condition;) {}
        for (longInitialize; longCondition;) {}
    }
}

// prettier-plugin-solidity 2.3.1
contract Foo {
    function bar() public {
        for (initialize; ; ) {}
        for (; condition; ) {}
        for (
            longInitialize;
            longCondition;

        ) {}
    }
}

// prettier-plugin-solidity 2.4.0
contract Foo {
    function bar() public {
        for (initialize; ;) {}
        for (; condition;) {}
        for (
            longInitialize;
            longCondition;
        ) {}
    }
}

Dependencies

Internal changes

  • Using the latest techniques to use prettier's printing functions allowed to trim a lot of now unnecessary code. by @Janther in #1500 and #1501
  • General refactors improving clean code, performance, and file size.

Full Changelog: v2.3.1...v2.4.0