Apr 23, 2023
Introducing Sui Move Analyzer-Development Made Simple
The Move programming language stands for the new generation of smart contracts language, which reshaped the cognition of DApp development by its security and efficiency. The schema of Move enforces resource safety and ownership, preventing issues such as use-after-free errors or resource leaks that lead to vulnerabilities.
With such powerful language features, analyzing and developing Move becomes a complex task. The original Move-Analyzer is primarily designed to provide developers with an IDE plugin on Visual Studio Code for analyzing and improving the code. Move-Analyzer is a combination of static analysis and LSP techniques, implemented functions such as highlighting, diagnostics, hover, etc, which meets the common requirement of Move developers. However, it has not yet satisfied the standard of an indispensable tool. Serval features are flawed, including snippet, completion, and navigation.
Fundamentally, the reason why the original analyzer remains imperfect is mainly due to the lack of support for the semantics analysis of Move, which is the cornerstone of high-quality IDE. Yet, this particular aspect of the language proves to be the most difficult and challenging work to overcome. After a long period of intense development and testing, here we are excited to announce the upcoming release of Sui-Move-Analyzer, a comprehensive upgrade including improvements to origin functions, framework integration, performance optimization, and more! Let’s dive into the new analyzer now and reveal its secrets.
In general, our upgrade mainly comprises improving the existing functions and introducing new modules for the Sui-Move environment, which results in a stable and reliable foundation for developers. You could learn how to install and apply the analyzer to your develop environment, and go through almost all features by watching the video here: https://youtu.be/79L0CrjLBUg.
Next, let’s take a deeper look into the details of how we implemented our features.
Fix & Enhancement
By refactoring the semantic analyzer, we redesign several key features, complete their function, and optimize the performance. We combined Language Server Protocol and TextMate, which is nearly capable to deal with all grammar structures. So far we achieved:
[ Go to definition ]
As the most commonly used function of the analyzer, we consider the navigation of code seriously. We add support for all [use] and [friend] statements, and reshape the outline.
[ Hover ]
The original analyzer missed built-in and spec functions, we add this support and make a detailed description while peeking.
[ Auto Completion ]
We have expanded the supported keywords on the original basis. Now it supported almost all of the items, including modules, variables, fields, types, etc.
In addition to the obvious and practical improvements, we have also optimized the code of the semantic analyzer, resulting in better efficiency and more reasonable memory allocation. You’ll easily notice this optimization when using our plugins.
Sui Develop Integration
For an experienced developer, language features are not enough to set up an efficient environment. To provide productivity, support for mainstream frameworks is also essential. We have given full consideration to this aspect as well. We have adopted the SUI framework in our work and have implemented many commonly used but critically important functionalities, including:
[ Project Support ]
Creating a new project and setting up all the required files and configurations from scratch can be time-consuming. We add up the features to create a new Sui framework project from the template. Besides, we also supported the multi-project development feature.
[ Code Snippets ]
At present, we have added support for some commonly used code snippets in Sui framework. For example, the developer can use [init] to quickly generate the initial function.
[ Integrated Sui client ]
Testing/Building is an essential aspect of smart contract development. We have integrated Sui unit test and Sui command-line tools into the plugin.
Move Specification Language (MSL) is the core of the Move Prover, another important role in the Move ecosystem. Yet, it remained a missing part of the Move Analyzer. We highly valued MSL and noticed this shortcoming. In our update, the necessary support for MSL is fully added into the analyzer, which includes:
[ Highlight ]
Spec has a highly flexible syntax, which we made different highlighting settings for its appearance under different circumstances.
[ Go to ]
Like how we managed the Move language, now MSL is also supported [go to definition] and [go to type definition] functions.
[ Auto Completion ]
We have added commonly used auto-complete functions for items like variables, statements, etc within specs, and we plan to make further support in the future.
Writing specifications from the ground can be annoying, so we add some practical quick generating options for functions and .move files.
Overall, our update is a significant endeavor, with many nuanced changes and details that developers will need to experience firsthand. We sincerely wish that these updates will facilitate more efficient, convenient, and comfortable development of Move smart contracts. However, we also acknowledge that there are areas in which the analyzer can be improved. To address these issues, we have arranged a drafted roadmap of future updates and a plan to continuously improve the platform. These improvements include:
[Move & MSL Formatting]
Formatting is a very important language feature, but the analyzer does not support this feature very well so far. We plan to add support in further development.
[Move Prover Linter]
As an essential part of the Move, the IDE support for Move Prover is still in the early stage. We are planning to redesign the linter, and enhance the error reporting and detection for MSL.
[Support More Framework]
Considering Move as a powerful ecosystem, it’s obvious that its IDEs and development tools should support more mainstream frameworks to facilitate smart contract development.
Overall, in this article, we have introduced the upcoming Sui-Move-Analyzer and detailed many exciting new features it includes. We highly recommend developers to try it out as soon as possible. With it, your development experience will be fundamentally enhanced. However, of course, although the new features have gone through careful testing, they may still contain some issues. We look forward to the feedback from developers on these improvements, and will continue to strive towards advancing the Move ecosystem! And don’t mind contacting MoveBit Team if you need help with the Move contract audit!
MoveBit is a blockchain security company focused on the Move Ecosystem by pioneering the use of cutting-edge Formal Verification. The team consists of security professionals from academia and enterprise with 10 years of security experience. they were one of the earliest contributors to the Move ecosystem, working with Move developers to set the standard for secure Move applications and make the Move ecosystem the most secure Web3 destination.