Solidity Compiler on Vscode

Solidity Compiler on Vscode

Blockchain development in vscode has been simplified to create extensions that can be installed to have a better workspace when building blockchain applications.

The solidity extension on vscode created by Juan Blanco makes your build easier and for the editor to understand the syntax and run its basic commands.

On building in an environment that has the extension activated, sometimes developers like myself run upon some compiler error as solidity has lots of versions.

Such errors that we often come across are:

CompileError: project:/contracts/Adoption.sol:2:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.8.16;

A quick fix to this error is changing it to the version you're building upon, so can this be done? By going to contracts folder and opening up the .sol folder you're working with, a red highlight will be on your pragma versioning which means there's a problem to fix.

Hover on to the highlighted error and right click and a you'll find some options to select from the solidity properties. Hover to the solidity: compile with configured Local solc file.

Screenshot from 2022-07-19 03-26-43.png

This prompt you to select the list of compilers option of your choice

Happy building!