7

I'm having a syntax error in VS Code in the parts where I emit events using new notation for Solidity v0.4.21.

Remix doesn’t raise any errors, though.

My User Settings in VS Code contain "solidity.compileUsingRemoteVersion": "latest", and compiler doesn't raise error on emit itself, rather gives this message:

Syntax error: Expected "!=", "%", "%=", "&", "&&", "&=", "*", "*=", "+", "++", "+=", ",", "-", "--", "-=", "/", "/*", "/=", ";", "<", "<<", "<<=", "<=", "=", "==", ">", ">=", ">>", ">>=", ">>>", "?", "^", "^=", "|", "|=", "||", comment, end of line, or whitespace but "(" found.

Here's how it looks like (2nd emit event is ok for some reason):

Emit event Syntax Error

2
  • Maybe this error is momentary, Try close and open the file again. Try pasting the code in remix UI, if it doesn't show any error or warning, then your code is well and good.
    – Rajesh
    Commented Mar 14, 2018 at 5:57
  • Tried all of this. Code in Remix is fine, syntax error in Visual Studio remains.
    – user34654
    Commented Mar 14, 2018 at 7:45

3 Answers 3

3

Issue was closed (and then reopened, and yet still awaiting updated Solium dependency to v1.1.6), please, currently update VS Solidity extension to v0.0.36.

1

My guess is that VS just doesn't understand what to do with the new notation. I wasn't sure if you mean VS can't even compile your code (don't have VS to try it myself), but if it can't, then it simply means that it can't use the new compiler properly.

Overall it's probably a limitation in current version of VS (and its compiler) and gets probably fixed in due time. Maybe try posting this problem somewhere in VS support forums to get it fixed faster?

3
  • Thanks, Lauri! Compilation completes successfully, I'll submit an issue on vscode-solidity GitHub.
    – user34654
    Commented Mar 14, 2018 at 9:02
  • 1
    Posted here: github.com/juanfranblanco/vscode-solidity/issues/57
    – user34654
    Commented Mar 14, 2018 at 9:52
  • Sweet! I see that the plugin has been updated and it now supports emit syntax
    – Andrey
    Commented Mar 17, 2018 at 18:40
0

Solium (syntax highligher) rules differs strongly from compiler rules (probably part of truffle package or Solidity for VS)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.