Clarity for Visual Studio Code
Clarity is a decidable Smart Contract language that optimizes for predictability and security. This VS Code extension brings essential features to write safe and clean Clarity code: auto-completion, linting, safety checks, debugger and more.
Clarity for Visual Studio Installation
You can install the latest release of the extension directly from VS Code or from the marketplace.
Auto Complete Functions
This feature enables you to start typing a function name, and then have the editor automatically suggest auto-completion with the documentation related to the suggestion.
Resolve contract-call targeting local contracts
The extension auto-completes local contract calls as well.
Check Contract on Save and Display Errors Inline
When a contract is opened or saved, the extension will notify you if errors are found (syntax, unknown keyword, etc), or warnings (such as unsafe code). This helps you to ensure that you write safe and clean code.
The debugging feature allows you to run Clarity code, line-by-line, so you can better understand what happens when it runs.
Note: This feature currently only runs on the desktop and requires a local installation of Clarinet.
For more information on how debugging works, and how you can debug smart contracts, please see the How to Debug Your Smart Contracts With Clarinet blog post.
Support VS Code for the Web
Support for Traits
When a contract implements a trait (such as the NFT of FT trait – SIPs 009 and 010), the extensions will show and errors if the trait implementation is incomplete (for example, if the trait expects a function which is not implemented, or if the function signature does not match the trait definition).
If your Clarity project relies on specific requirements (eg: SIPs 009 or 010) for interacting with contracts on mainnet, the extension will automatically detect and cached the required contracts.
Contributing to this Extension
Hiro welcomes feedback, comments and suggestions to improve this extension over time.
Run the extension locally
You'll need to have Rust, Node.js and NPM installed.
The LSP has two main parts: the client and the server. These two parts will run in different environments:
The LSP (