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

Incorrect solidity grammar highlighting problems #8

Open
cyberthirst opened this issue Jul 18, 2022 · 6 comments
Open

Incorrect solidity grammar highlighting problems #8

cyberthirst opened this issue Jul 18, 2022 · 6 comments

Comments

@cyberthirst
Copy link
Contributor

The grammar used in the extension doesn't correctly highlight symbols if they are followed by curly braces {}.

Examples for reproduction:

.deposit{ value: amount }();
new Tester{ salt: salt }(..);
@michprev
Copy link
Member

Another example (taken from https://docs.soliditylang.org/en/v0.8.15/assembly.html#access-to-external-variables-functions-and-libraries):

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.10 <0.9.0;

contract C {
    // Assigns a new selector and address to the return variable @fun
    function combineToFunctionPointer(address newAddress, uint newSelector) public pure returns (function() external fun) {
        assembly {
            fun.selector := newSelector
            fun.address  := newAddress
        }
    }
}

address in the func.address expression should not be highlighted.

@michprev
Copy link
Member

image
virtual, override in a modifier definition

@michprev
Copy link
Member

michprev commented Sep 3, 2022

image

@cyberthirst
Copy link
Contributor Author

incorrect highlighting of variable name hash in variable declaration:
image

@cyberthirst
Copy link
Contributor Author

payable is not highlighted when used in format: address payable addr

@honzaprevratil
Copy link

honzaprevratil commented Mar 26, 2024

  1. Function argument mapping(...) storage X causes other function arguments and comments to be yellow (line 11 to line 13 - highlighting does not work), until the beginning of the function.

  2. The comment in the place where modifiers are expected is yellow (line 19)

Printscreen of problem:
image

Code (here in GitHub's highlighting it works):

contract Highlighting {

    mapping(address account => uint256 tokensA) public claimedATokens;
    mapping(address account => uint256 tokensB) public claimedBTokens;

    function _claimTokens(
        uint256 bonus, // syntax highligting works here
        mapping(address => uint256) storage _tokenMapping, //this line brokes syntax highlighting
        address account, //not working
        uint256 amountToClaim //not working
    )  internal { // from here it is working again
        // some more common code
        _tokenMapping[account] = _tokenMapping[account] + amountToClaim + bonus;
    }

    function claimATokens(address account, uint256 amountToClaim /*green coment*/) external /*yellow coment?*/ {
        // ... code specif for A ...
        _claimTokens(0, claimedATokens, account, amountToClaim);
    }

    function claimBTokens(address account, uint256 amountToClaim) external {
        // ... code specif for B ...
        _claimTokens(1, claimedBTokens, account, amountToClaim);
    }
}

@honzaprevratil honzaprevratil changed the title incorrect solidity grammar highlighting Incorrect solidity grammar highlighting problems Mar 26, 2024
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