6

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

  • 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 Mar 14 '18 at 5:57
  • Tried all of this. Code in Remix is fine, syntax error in Visual Studio remains. – rrickdar Mar 14 '18 at 7:45
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?

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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.