Skip to main content
Version: 5.x

ink! Analyzer

ink! analyzer is a collection of modular and reusable libraries and tools for semantic analysis of ink! smart contract code.

ink! analyzer aims to improve ink! language support in integrated development environments (IDEs), source code editors and other development tools by providing modular and reusable building blocks for implementing language features (e.g. diagnostic errors, quick fixes, code completion suggestions, code/intent actions and hover content e.t.c) for the ink! programming language.

Problem

While ink! developers can leverage Rust tooling and excellent IDE/code editor support via rust-analyzer and IntelliJ Rust because "ink! is just standard Rust in a well-defined "contract format" with specialized #[ink(…)] attribute macros", relying on only generic Rust language support in IDEs, code editors and other development tools has some significant limitations for the developer experience including:

Solution

To solve the above challenges and improve ink! language support in IDEs, code editors and other development tools, ink! analyzer creates two main components:

These two components 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 either via configurable LSP clients or robust LSP client libraries/APIs/modules, including Visual Studio Code, Visual Studio, Vim / Neovim, Emacs, Atom, Sublime Text, Acme, Lapce, Eclipse and many more.

ink! analyzer makes it relatively easy for:

  • Users to enable ink! language support for their IDE, code editor or other development tool if it has either a native/built-in or third-party LSP client that can be configured to launch an LSP server using an executable command (i.e. the path to an installed ink! Language Server binary) and can use stdio (standard in/standard out) as the message transport.
  • Developers to either build extensions/plugins/integrations that add ink! language support to any tool with robust LSP client libraries/APIs/modules, or add first-class ink! language support to an existing LSP client (e.g. an open-source extension/plugin/integration).

In addition to distributing compiled ink! Language Server (ink-lsp-server) binaries for most of the major platforms/architectures, ink! analyzer additionally distributes a Visual Studio Code extension that ships with a bundled ink! Language Server as a showcase and reference implementation for the latter use case.

Diving Deeper

To learn more about ink! analyzer, read the introductory blog post and/or check out the ink! analyzer organization on GitHub for source code, technical documentation, installation and usage instructions, and links to useful resources.

Issues, bug reports, PRs and feature requests are welcome at the respective GitHub repositories 🙂.