Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter removes semicolon after the virtual modifier declaration #219

Closed
matmilbury opened this issue Aug 4, 2022 · 3 comments
Closed

Comments

@matmilbury
Copy link

I have the following file:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

abstract contract Foo {
    modifier bar() virtual;
}

When I format it with hardhat-vscode, the formatter removes the semicolon after the modifier:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

abstract contract Foo {
-    modifier bar() virtual;
+    modifier bar() virtual
}

which results in invalid solidity code.

The issue seems to disappear when the modifier gets a default implementation:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

abstract contract Foo {
    modifier bar() virtual {
        _;
    }
}
@kanej
Copy link
Member

kanej commented Aug 5, 2022

I have been able to reproduce the example via the hardhat-vscode format call.

When I run the on the same input via prettier-plugin-solidity which we use for formatting under the hood, we don't get this issue.

The next step is to debug and figure out why formatting via the plugin gives a different result than via prettier at the cli.

@kanej
Copy link
Member

kanej commented Aug 11, 2022

Released as part of v0.5.0

@matmilbury
Copy link
Author

Thank you! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants