ink! analyzer
A library for semantic analysis of ink! smart contracts.
It implements utilities for performing semantic analysis of ink! smart contract code. It therefore implements the core functionality of ink! analyzer at a high level.
It currently implements an Analysis entry point that accepts a string representation (&str)
of ink! smart contract code as input and defines associated methods that compute:
- diagnostics - errors and warnings based on ink! semantic rules.
- quickfixes - suggested edits/code actions for fixing diagnostic errors and warnings.
- completions - inline code suggestions for ink! attribute macros, arguments and items for defining and configuring your ink! smart contract's storage, constructors, messages, events, errors, tests and much more.
- code/intent actions - contextual assists for:
- adding relevant ink! attribute macros, arguments and entities/items
- migrating ink! projects to newer versions of ink! (e.g. ink! 4.x to 5.0)
- extracting ink! items (e.g. ink! events) into standalone packages
- and more!
- inlay hints - inline type and format information for ink! attribute argument values
(e.g.
u32 | _ | @for ink! message selectors). - signature help - popup information for valid ink! attribute arguments for the current context/cursor position.
- [hover content] - popup documentation for ink! attribute macros and arguments.
Installation
Run the following Cargo command in your project directory
cargo add ink-analyzer
Usage
Example:
Analyzing ink! smart contract code.
use ;
Documentation
https://docs.rs/ink-analyzer/latest/ink_analyzer/
Or you can access documentation locally by running the following command from the project root
cargo doc -p ink-analyzer --open
Testing
You can run unit and integration tests for all the core functionality by running the following command from the project root
cargo test -p ink-analyzer
License
Licensed under either MIT or Apache-2.0 license at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.