Skip to main content

ink! Analyzer Updates

ยท 3 min read
David Semakula

I am proud to announce the successful completion of another Web3 Foundation grant for updating ink! analyzer - a collection of modular and reusable libraries and tools for semantic analysis of ink! smart contract code.

If you're new to ink! analyzer (or if you need a refresher ๐Ÿ™‚), you can refer to the introductory blog post for a deep dive into the problem, solution and technical descriptions of each of the architectural components of the project.

What's new?โ€‹

This stage of the project has improved ink! language support features across all components by adding:

  • Quick fixes for all diagnostic errors and warnings.
  • ink! e2e test macro support (i.e diagnostics, quickfixes, completions, code actions and hover content).
  • A command for creating an ink! project (with a contract stub/snippet).
  • Code/intent actions for inserting code stubs/snippets for contextually relevant ink! entities (i.e. full items not just attributes e.g. an #[ink(event)] annotated struct, an #[ink(message)] annotated fn e.t.c).
  • Inlay hints and signature help/parameter hints for ink! attribute arguments (e.g. u32 | _ for ink! selectors, impl Environment for env arguments e.t.c).
  • Code/intent actions for "flattening" ink! attributes.
  • Diagnostics that verify that the value of env and environment arguments for #[ink::contract] and #[ink_e2e::test] respectively impl Environment as well as quick fixes to impl Environment for the target item where necessary.
  • Diagnostics that verify chain extension ErrorCode types, and other input and output types, implement required traits (e.g. FromStatusCode for ErrorCode types, and SCALE codec traits - i.e. scale's Encode and Decode and scale-info's TypeInfo traits - for ErrorCode types, and input and output types of chain extension methods) as well as quick fixes to implement the required traits for the target items where necessary.
  • Diagnostics and quickfixes for ink! trait definition implementations that don't match the ink! trait definition (e.g. implementing missing methods, removing undeclared methods, fixing method signatures, updating ink! attributes to match the trait definition e.t.c).

Conclusionโ€‹

You can learn more about all ink! analyzer components in the introductory blog post (including links to all available project resources in the "Diving Deeper" section), and/or checkout the ink! analyzer organization on GitHub for: installation, development, usage and testing instructions, library documentation, low-level technical and architectural descriptions, access to the source code, and distributable releases of the ink! Language Server and VSIX packages for the VS Code extension (if you prefer not to use the VS Code marketplace) for most of the major platforms/architectures.

Issues, bug reports, PRs and feature requests are welcome at the respective GitHub repositories ๐Ÿ™‚.

Special thanks to the Web3 Foundation for funding ink! analyzer's development via two generous grant.