patriciobcs / solana-snippets

VSCode extension to quickly write and customize well tested Solana snippets.
MIT License
20 stars 1 forks source link
rust solana vscode vscode-extension

Solana Snippets

The Solana Snippets VSCode Extension allows you to quickly insert Solana snippets into your code or your terminal. The snippets are tested in a real Solana program (code) or real Shell Scripts (terminal), and presented as VSCode and Rust Analyzer snippets with a sidebar to navigate through them.

demo

Snippets

Snippets are small fragments of code that can be used to speed up the development process. In this extension you can find three types of snippets:

Icon Type Description Trigger Example
VSCode VSCode format snippets (work in all files) > Anchor Program Structure
Rust Analyzer Rust Analyzer snippets. They have automatic imports in Rust. Currently only in Native. __ Transfer SOL
Terminal Terminal commands snippets that run directly in the VSCode integrated terminal Get Airdrop

All the snippets are defined in multiple Rust files. This files uses comments to define the beginning and ending of the snippet. This approach allows to build and test the snippets before compiling the snippets to JSON and package them into the extension.

Usage

Contributing

State

Current

Next

let account_info_iter = &mut accounts.iter();
let account_one_info = next_account_info(account_info_iter)?;
let account_two_info = next_account_info(account_info_iter)?;
...

Release Process

The extension is currently tagged and released manually. Once a new version have tested all the snippets and deemed ready for release:

Bump Version

Create Github tag

Snippets extension tag are of the form solana-snippets-vX.Y.Z. Create the new tag at the version-bump commit and push to the repository, eg:

git tag solana-snippets-v1.0.0 b24bfe7
git push upstream --tags

Publish release

Disclaimer