prettier-plugin-solidity icon indicating copy to clipboard operation
prettier-plugin-solidity copied to clipboard

Override modifier getting deleted ?

Open ianmihura opened this issue 6 years ago • 12 comments

So, this might not be the correct place to post this. I'm coming from VScode, using this Solidity extension, which seems to be using your module to format the code, in :14

Might be the problem is coming from another place, tho I doubt it, as the VScode extension seems to manage the override modifier missing error correctly, and the problem arises only as the formatter is applied to the file.

Anyway, a similar issue already exists in the appropriate repo, issue 174, I'm only passing thru to check on you guys as well.

Cheers

ianmihura avatar May 17 '20 00:05 ianmihura

Using https://github.com/juanfranblanco/vscode-solidity formatting a contract with the override keyword results in the override keyword being removed

Unformatted

pragma solidity ^0.6.0;


contract A {
    function doStuff() public virtual {}
}


contract B is A {
    function doStuff() public override {}
}

Formatted

pragma solidity ^0.6.0;


contract A {
    function doStuff() public virtual {}
}


contract B is A {
    function doStuff() public {}
}

abcoathup avatar May 20 '20 05:05 abcoathup

This was solved on version v1.0.0-alpha.49 Perhaps @juanfranblanco can publish a newer release pointing to the latest release?

Janther avatar May 20 '20 06:05 Janther

@Janther @ianmihura yes it is is already there.. i was testing the caching feature before release.

juanfranblanco avatar May 20 '20 16:05 juanfranblanco

Great, thank you, amazing work 🙌

ianmihura avatar May 20 '20 16:05 ianmihura

Closing since this vscode-solidity has been updated

Janther avatar May 20 '20 23:05 Janther

This problem still exists for contract state variables:

Before formatting: mapping(address => bool) public override varName; After formatting: mapping(address => bool) public varName;

smoove avatar May 27 '20 09:05 smoove

the same problem here do you think @Janther ?

mattiaerre avatar May 28 '20 01:05 mattiaerre

Nope, this one is on us, first I’ll check if the parser identifies virtual and override in these cases

On Thu, 28 May 2020 at 13:29, Mattia Richetto [email protected] wrote:

the same problem here do you think @Janther https://github.com/Janther ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/prettier-solidity/prettier-plugin-solidity/issues/277#issuecomment-635037175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZQZR7GDXHEWUTO3YASX3RTW477ANCNFSM4NDETUZQ .

Janther avatar May 28 '20 01:05 Janther

Was this fixed by #281?

fvictorio avatar Jun 03 '20 15:06 fvictorio

Oh, modifiers still pending, sorry.

fvictorio avatar Jun 03 '20 15:06 fvictorio

Using [email protected] and [email protected] and the override keyword is still getting deleted on a non-abstract contract.

Update: nevermind, I upgraded to [email protected] and that works well.

PaulRBerg avatar Jun 09 '20 09:06 PaulRBerg

I'm gonna close this issue then 😊

mattiaerre avatar Jun 09 '20 20:06 mattiaerre