Hello, I'm David Semakula (@davidsemakula) - the creator of ink! analyzer.
ink! analyzer is a collection of modular and reusable libraries and tools for semantic analysis of ink! smart contracts.
In short, ink! analyzer is to ink!, what rust-analyzer is to Rust.
More technically, rust-analyzer is a Rust compiler frontend/semantic analyzer for IDEs that's built on
a lossless and resilient parser (this part is very important for IDE/editor tooling because the program is essentially
perpetually incorrect as you type in an IDE/editor). So rust-analyzer "understands" core Rust language concepts
(e.g. that a trait implementation like impl MyTrait for MyStruct {}
must define all the required associated items of the trait),
and provides intelligent editing features to help you with those kinds of core Rust language features.
However, when it comes to Rust syntax extensions/DSLs like ink!'s attribute macros,
when you annotate a mod
item with #[ink::contract]
, all rust-analyzer "knows" is that this is a custom attribute,
it doesn't "know" that an ink! contract mod
must have exactly one struct
item annotated with #[ink(storage)]
or any of the other semantic rules for ink! contracts, so this is where ink! analyzer comes in 🙂.
For a deeper dive on the problems ink! analyzer solves and technical details about its architecture,
check out this detailed introductory blog post.
You can also check out this awesome X/Twitter thread by the ink! lang team for a quick walkthrough of ink! analyzer features.
ink! analyzer's most user/developer facing component is currently a Visual Studio Code extension,
which has over ~350 unique installs (first released in Aug/2023).
However, ink! analyzer is built with an IDE/editor agnostic architecture to maximize re-usability of it's core components i.e.
Figure 1: ink! Analyzer - LSP based Architecture Diagram
These two components (i.e. the semantic analyzer and language server) can be reused
to add ink! language support to multiple IDEs, code editors and other development tools.
In particular, a large number of IDEs and code editors support LSP servers, these include
Visual Studio Code, Visual Studio, Vim / Neovim, Emacs, Atom, Sublime Text, Acme, Lapce, Eclipse and many more.
Therefore, ink! analyzer makes it relatively easy for:
The latter option typically provides a better user experience as the user doesn't have to manually install (and update)
the ink! Language Server as it can be bundled (or installed/updated) by the extension/plugin/integration.
The Visual Studio Code extension serves as a showcase and
reference implementation for this use case/approach.
However, ink! analyzer also distributes compiled ink! Language Server (ink-lsp-server
) binaries for most of the major platforms/architectures
for non-VS Code users and developers.
NOTE: While the first version of the ink! analyzer VS Code extension was released in Aug/2023,
work on the core components (i.e. semantic analyzer and language server) started well before in Mar/2023.
This treasury proposal requests retroactive funding for adding ink! v5 support to ink! analyzer.
Requested Amount: $26,500 / 2,812.27 DOT[^1]
Breakdown/Tasks | Hours |
---|---|
Add architectural foundations for supporting both v4 and v5 language versions across IR, semantic analyzer and language server | ~24 |
Update IR (Intermediate Representation) and attribute parser to support all v5 syntax and entities (including deeply nested meta-items and @ selector values) while preserving legacy support for v4 (also includes unit tests) | ~80 |
Add diagnostics and quickfixes for v5 entities and related attribute macros and arguments (while preserving legacy support for v4)
|
~136 |
Add v5 support for completions, code/intent actions, hover content, inlay hints and signature help (while preserving legacy support for v4)
|
~96 |
Add v5 codegen (while preserving legacy support for v4) | ~8 |
General maintenance and performance improvements
|
~48 |
Integration tests (across semantic analyzer, language server and VS Code extension) | ~24 |
Documentation | ~8 |
Total Hours | ~424 |
Hourly Rate | $62.5 |
Total Amount | $26,500 |
NOTE: All ink! analyzer components are fully open-source and distributed under OSI approved licenses.
All previous work for ink! analyzer was funded by two generous Web3 Foundation technical grants.
However, with the project now relatively mature and having some meaningful adoption,
I'm looking to move to a retroactive treasury funding model for future updates.
NOTE: ink! v5 has only recently been released (13/Mar/2024),
and so was outside the scope of the above Web3 Foundation technical grants.
However, work on ink! v5 support in ink! analyzer started well before the official ink! v5 release.
Historically, as noted above, all previous work for ink! analyzer was funded by Web3 Foundation technical grants.
This is partly because development of ink! analyzer kicked off in Mar/2023,
while the ink!ubator: Ecosystem Grants program
only started receiving grant applications around ~May/2023
(note that discussions for the Wasm Smart Contracts Bounty started well before this though).
In the present, with ink!ubator being an incubation program following a cohort schedule,
and ink! analyzer now being a relatively mature project with some meaningful adoption, the need to support
new ink! features and syntax as close to release as possible (hence the choice of retroactive funding),
means the ink!ubator cohort schedule is not a good fit for this stage of the project.
I'm an independent Software Engineer & Systems Architect with over 10+ years of experience.
I also independently contribute to rust-analyzer (a Rust compiler front-end for IDEs).
I've also made some independent contributions to ink!.
You can check out my GitHub profile and/or my personal website for more details.
[^1]: DOT/USD rate uses EMA30 rate from Subscan retrieved on 27/Mar/2024.
Hi @David Semakula ,
Thanks for the proposal, I support it. I installed the extension on VSCode, and looking forward to developing with it.
Best regards,
kukabi | Helikon