Skip to content

Releases: prettier-solidity/prettier-plugin-solidity

v2.0.0-beta.8

25 Mar 10:38
bd5ece9
Compare
Choose a tag to compare
v2.0.0-beta.8 Pre-release
Pre-release

What's Changed

Full Changelog: v2.0.0-beta.7...v2.0.0-beta.8

v2.0.0-beta.7

30 Jan 00:48
Compare
Choose a tag to compare
v2.0.0-beta.7 Pre-release
Pre-release

What's Changed

Full Changelog: 2.0.0-beta.6...v2.0.0-beta.7

2.0.0-beta.6

06 Jan 23:04
Compare
Choose a tag to compare
2.0.0-beta.6 Pre-release
Pre-release

New features

  • Add support for transient keyword in the solidity-parse parser by @Janther in #1079

Format changes

  • Don't re-write import * as ... from ... in the solidity-parse parser by @Janther in #1083
// Original
import * as SomeSymbol from "AnotherFile.sol";

// [email protected]
// { parser: 'solidity-parse' }
import "AnotherFile.sol" as SomeSymbol;

// [email protected]
// { parser: 'solidity-parse' }
import * as SomeSymbol from "AnotherFile.sol";

Breaking changes

Full Changelog: v1.4.1...v1.4.2

v1.4.2

06 Jan 23:00
03b224d
Compare
Choose a tag to compare

New features

Format changes

// Original
import * as SomeSymbol from "AnotherFile.sol";

// [email protected]
import "AnotherFile.sol" as SomeSymbol;

// [email protected]
import * as SomeSymbol from "AnotherFile.sol";

Breaking changes

Full Changelog: v1.4.1...v1.4.2

v2.0.0-beta.5

20 Dec 06:21
1ca44e3
Compare
Choose a tag to compare
v2.0.0-beta.5 Pre-release
Pre-release

Smaller bundled file size and performance improvements.

v2.0.0-beta.4

20 Dec 06:15
Compare
Choose a tag to compare
v2.0.0-beta.4 Pre-release
Pre-release

Fix a bug in the previous release with the unpkg endpoint.

v2.0.0-beta.3

20 Dec 06:11
1cf3dfd
Compare
Choose a tag to compare
v2.0.0-beta.3 Pre-release
Pre-release

Features

  • Support for Slang 18
  • Support for the browser was added back

Breaking changes

  • Slang provides a wasm endpoint that relies on ESM features. Therefore we had to drop UMD and CommonJS support in order to bundle a package for the browser.

v2.0.0-beta.2

01 Oct 06:28
921b501
Compare
Choose a tag to compare
v2.0.0-beta.2 Pre-release
Pre-release

Moving closer to a release candidate, this pre-release adds the following features:

2.0.0-beta.1

18 Sep 10:11
Compare
Choose a tag to compare
2.0.0-beta.1 Pre-release
Pre-release

This year we have been working hard on adopting Nomic Foundation's Slang as our new parser.

This allowed us to update our architecture, address issues that the ANTLR parser was blocking, have more control in the rendering of comments, and officially move our codebase to typescript.

While in beta, we will still serve the solidity-parse parser, but the plugin will now log a deprecation warning recommending using the slang-solidity parser.

To start using the new parser just replace solidity-parse with slang-solidity in the .prettierrc file.

{
  "plugins": ["prettier-plugin-solidity"],
  "overrides": [
    {
      "files": "*.sol",
      "options": {
        "parser": "slang-solidity",
        "printWidth": 80,
        "tabWidth": 4,
        "useTabs": false,
        "singleQuote": false,
        "bracketSpacing": false,
        "compiler": "0.8.26",
      }
    }
  ]
}

If a compiler version is specified, this will be used to parse all the contracts in your project. By default the compiler version will be the latest Solidity version supported by @nomicfoundation/slang. The final 2.0.0 release will infer the Solidity version from the pragma statements in each contract.

A wasm build of the @nomicfoundation/slang package is not included in this beta release. This means the beta release can currently be used in node projects and build pipelines where Rust is supported.

We are working with Nomic Foundation to include a wasm build in the final 2.0.0 release to support browser based IDEs like Remix.

import prettier from 'prettier';
import solidityPlugin from 'prettier-plugin-solidity';

async function format(code) {
  return await prettier.format(code, {
    parser: 'slang-solidity',
    compiler: '0.8.26',
    plugins: [solidityPlugin],
  });
}

const originalCode = 'contract Foo {}';
const formattedCode = format(originalCode);

We invite everyone to try this new version out and welcome reports of new issues.

v1.4.1

18 Aug 07:44
889a5bb
Compare
Choose a tag to compare

@pcaversaccio let us know that one of our formatting decisions was formatting an expected result so this was quickly reverted to the previous standard.

// Input
contract Comments {
    function ifElse() public {
        if (condition) {
            // ...
        } // Reason for else case
        else {
            // ...
        }
    }
}

// v1.4.0
contract Comments {
    function ifElse() public {
        if (condition) {
            // ...
        } else {
            // Reason for else case
            // ...
        }
    }
}

// v1.4.1
contract Comments {
    function ifElse() public {
        if (condition) {
            // ...
        } // Reason for else case
        else {
            // ...
        }
    }
}