language-ethereum icon indicating copy to clipboard operation
language-ethereum copied to clipboard

Extra level of indentation after close of conditional block

Open wbt opened this issue 5 years ago • 0 comments

Steps to reproduce:

  1. In Atom with language-ethereum installed, create a new MyContract.sol file.
  2. Write or paste code like the following:
pragma solidity ^0.4.24;

contract MyContract {
    uint private winningNumber;
    function isAWinner(uint entryNum) public view returns (bool) {
        if(entryNum == winningNumber) {
            return true;
            //Everything below this line is auto-indented one level too many.
        } else {
            uint secondChance = entryNum*entryNum;
            return (secondChance == winningNumber);
        }
    }
}
  1. Select All.
  2. Auto-indent.

Expected behavior: Code formatted like the above (when a tab is set to 4 spaces).

Actual behavior: All lines after the comment are indented one level to the right of where they should be.

Other notes: The indentation works fine if the file is renamed to have a .js extension, because a different package applies.

wbt avatar Feb 18 '20 21:02 wbt