Although web3 development tools are still pretty new as compared web2 there are some pretty nifty VS code plugins that can help you fast track your development. Here is a list of some of the most useful ones I have found so far:
PS: If you want a quick highlight checkout our short video:
Solidity support for Visual Studio code
This is one of the most popular plugin for web3 if you work with solidity. The plugin provides: – Syntax highlighting – Snippets – Compilation of the current contract (Press F1 Solidity : Compile Current Solidity Contract), or F5 – Compilation of all the contracts (Press F1 Solidity : Compile all Solidity Contracts), or Ctrl+F5 / Cmd+F5 – Code completion for all contracts / libraries in the current file and all referenced imports – Default project structure (solidity files needs to be in the ‘src’ directory, and libraries in the ‘lib’ directory). Libraries will follow the same structure. – Compilation supporting EIP82 (dappfile and dependency packages) – Support for different solidity versions (Remote and local) – Code generation using https://github.com/Nethereum/Nethereum, it includes currently the default template for Nethereum service, dtos generation. (Open ‘contractName.json’ after compilation from the bin folder. Press F1 and press Solidity: Code generate from compilation output..) Auto generation of Nethereun files on compilation – Linting using Solhint or Solium
Debugging solidity code is a tricky affair. Solidity debugger extension for Visual Studio Code supports breakpoints, stepping, rewinding, call stacks, local & state variable inspection. This can save you a lot of time.
Hardhat for Visual Studio Code
This plugin brings Hardhat support for Visual studio code. Hardhat is an Ethereum development environment that lets you compile your contracts and run them on a development network. This plugin provides: – Code completion – Go to definition, type definition and references – Symbol renames – Solidity code formatting through prettier-plugin-solidity – Inline code validation from compiler errors/warnings for Hardhat projects – Hover help for variables, function calls, errors, events etc. – Code actions (quickfixes) suggested from compiler errors/warnings for Hardhat projects – Implement missing functions on interface with stubs – Constrain mutability by adding
pure to function signature – Meet inheritance requirements by adding
override on function signature – Provide accessibility by adding
private to function signature
Blockchain Development Kit for Ethereum
If you use Truffle and Ganche for your blockchain development, this is an useful plugin. This plugin allows you to create, build and deploy smart contracts on Ethereum with built in integration for open source tools such as Truffle, Infura, and OpenZeppelin. Optionally it plays well with the Azure blockchain stack. Be aware that this plugin is only available for windows and mac, so if you are on linux, you are out of luck!
Ethereum Remix Project extension for Visual Studio Code
This plugin brings remix IDE support to visual studio code. Remix is a web based IDE built by the team at Ethereum. It is widely used for quickly get started for blockchain development in ethereum. It allows developers to access and interact with the file system, components, extensions and other Remix plugins without actually having to create a different code base.
Solidity Visual Developer
This extension contributes security centric syntax and semantic highlighting, a detailed class outline, specialized views, advanced Solidity code insights and augmentation to Visual Studio Code. The plugin supports:
- access modifiers (
- security relevant built-ins, globals, methods and user/miner-tainted information (
- storage access modifiers (
- developer notes in comments (
- custom function modifiers
- contract creation / event invocations
- easily differentiate between arithmetics vs. logical operations
- make Constructor and Fallback function more prominent
Code fragments passively draw your attention to statements that typically reduce risk () or need your attention ().
- highlights StateVars (constant, inherited)
- detects and alerts about StateVar shadowing
- highlights function arguments in the function body
- audit annotations/bookmarks –
@audit - <msg>
@audit-ok - <msg>(see below)
- generic interface for importing external scanner results – cdili json format (see below)
- codelens inline action: graph, report, dependencies, inheritance, parse, ftrace, flatten, generate unittest stub, function signature hashes, uml
Graph- and Reporting Features
- 💒🤵👰 vscode-solidity-auditor ⚭ Sūrya
- access your favorite Sūrya features from within vscode!
- interactive call graphs with call flow highlighting and more!
- 📈🎉 auto-generate UML diagrams from code to support your threat modelling exercises or documentation!
- Hover over Ethereum Account addresses to download the byte-code, source-code or open it in the browser
- Hover over ASM instructions to show their signatures
- Hover over keywords to show basic Security Notes
- Hover over StateVar’s to show declaration information
- Cockpit View
- Explor and focus on solidity files in your workspace
- Generate report/graphs for any files/folders selected in the explorer views
- Selectively flatten files
- Search for contracts that are likely to be deployed in the system
- Context-sensitive views: click into a contract in the editor to list public state-changing method
- Get quick access to extension settings
- Outline View
- populates VS Code outline view with sourceUnit and contract layout
- contracts, stateVars, methods, inherited names
- annotates security relevant information (visibility, …)
- calculates complexity rating
- annotations functions with information about whether they are accessing stateVars
Lastly a fun little plugin to give you details about an eth address when you hover over it. Hover over an ethereum address and: – Open it in etherscan (or whatever you configure) – Show address balance in hover (mainnet) (note: might be rate-limited, configure your API key in settings) – Download the bytecode and disassemble it. – With hover info on instructions – Representation of data as ASCII and resolving 4bytes to funcsigs, Color code reflects the type of instruction: stack, memory, storage, arithm., logic, system, environment, … – Download the bytecode and show it. – With hover info – Click to see instruction boundaries – Color coded bytes to reflect type of instruction) – Show verified contract source (etherscan.io) – Show reconstructed contract source from eveem.org – Show reconstructed contract source from evm.js – run vscode-decompiler to decompile it manually using panoramix (eveem.org) locally