Table of Contents
The sui-move-analyzer is a Visual Studio Code plugin for Sui Move language developed by MoveBit. Although this is an alpha release, it has many useful features, such as highlight, autocomplete, go to definition/references, and so on.
Here are some of the features of the sui-move-analyzer Visual Studio Code extension. To see them, open a
Move source file (a file with a .move
file extension) and:
Move.toml
file can be
found in one of its parent directories), the following advanced features will also be available:
Note:
1.If you already have installed move-analyzer or aptos-move-analyzer, please disable them before installing sui-move-analyzer, because it may have some conflicts.
2.You need to install SuiCLI refer as https://docs.sui.io/references/cli before install sui-move-analyzer
.
The sui-move-analyzer
Visual Studio Code extension works via two components: the sui-move-analyzer language server
and the extension itself. Below are two steps that describe how to install all of them.
sui-move-analyzer language server
sui-move-analyzer language server
may be installed in one of two ways:
Windows & MacOS & Ubuntu
1.Download the newest binary files for the corresponding platform from sui-move-analyzer-releases-pages.
2.Rename it to
sui-move-analyzer
orsui-move-analyzer.exe
.3.Make sure
sui-move-analyzer
/sui-move-analyzer.exe
can be found in your PATH environment.
After completing the above steps, restart VSCode.
The sui-move-analyzer
language server is a Rust program, so we suggest installing it via cargo
. If you haven't installed the Rust toolchain, you can install Rustup, which will install the latest stable Rust toolchain including cargo
.
Execute the below command to install sui_move_analyzer
cargo install --git http://github.com/movebit/sui-move-analyzer --branch master sui-move-analyzer
The installation may take some time, often several minutes. After installation, the sui-move-analyzer
program is in your cargo
binary directory. On macOS and Linux, this directory is usually ~/.cargo/bin
. You should make sure this location is in your PATH
environment variable via export PATH="$PATH:~/.cargo/bin"
.
To confirm that you've installed the language server program successfully, execute
sui-move-analyzer --version
on the command line. You should see the output sui-move-analyzer version number(1.1.2)
.
If you don't see it, check the troubleshooting section at the end.
After completing the above steps, restart VSCode.
sui-move-analyzer
Visual Studio Code extension⇧⌘P
on macOS, or use the menu item View > Command Palette...) and
type Extensions: Install Extensions. This will open a panel named Extensions in the
sidebar of your Visual Studio Code window..move
. Or to create a new file, click Select a language, and
choose the Move language. As you type, you should see that keywords and types appear in
different colors.After completing the above steps, restart VSCode.
Please note: If you don't see the version number, you can refer to the troubleshooting section."
sui-move-analyzer
programIf you are installing this extension on a Windows system and have followed the steps in Section 1.A by running the windows-installer.msi, but executing sui-move-analyzer --version
in the command line doesn't find the sui-move-analyzer
program, the issue may be that VSCode cannot locate the configured environment variables. You can try the following:
sui-move-analyzer
VSCode extension.PATH
. Look for an entry ending with MoveBit\sui-move-analyzer\
, and copy it.sui-move-analyzer
in the VSCode extension store. In the sui-move-analyzer > server:path
entry, add the path ending with MoveBit\sui-move-analyzer\
before sui-move-analyzer
. The final result may look like: C:\Users\YourUserName\AppData\Local\Apps\MoveBit\sui-move-analyzer\sui-move-analyzer.exe
sui-move-analyzer --version
in the command line again.If you see an error message language server executable sui-move-analyzer
could not be found in the
bottom-right of your Visual Studio Code screen when opening a Move file, it means that the
sui-move-analyzer
executable could not be found in your PATH
. You may try the following:
sui-move-analyzer --version
in a command line terminal prints out
sui-move-analyzer version number
. If it doesn't, then retry the instructions in [step 1]. If it
does successfully print this output, try closing and re-opening the Visual Studio Code
application, as it may not have picked up the update to your PATH
.sui-move-analyzer
executable to a different location that is outside of your
PATH
, then you may have the extension look at this location by using the the Visual Studio Code
settings (⌘,
on macOS, or use the menu item Code > Preferences > Settings). Search for the
sui-move-analyzer.server.path
setting, and set it to the location of the sui-move-analyzer
language
server you installed.Macos cannot verify if this app contains malicious software
, you need to add support for sui-move-analyzer
in the system settings Program Trust.Open a Move source file (a file with a .move file extension) and if the opened Move source file is located within a buildable project (a Move.toml file can be found in one of its parent directories), the following advanced features will be available:
Therefore, the Move.toml file must be found in the project directory for the plug-in's functionality to take effect.
In addition, if you have already opened the move project before, the installed plug-in will not take effect in time. You need to reopen the vscode window and open the move project code again before the plug-in is activated.
When you first open a project, there will be some dependencies (configured in Move.toml) that need to be downloaded, so you need to run the sui move build
command first to build
the project. During the build process, the dependencies will be downloaded. Once all the dependencies for the project have been downloaded, sui-move-analyzer can properly parse
the dependencies and project source code.
If cargo install --git http://github.com/movebit/sui-move-analyzer --branch master sui-move-analyzer
run failed, and meet the
error info as follows:
error: failed to run custom build command for librocksdb-sys...
--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching:
['clang.dll', 'libclang.dll']..."'
It's because it relies on MystenLabs/sui_move_build
library, which requires an LLVM environment. You can refer to llvm-project go and install llvm.
1.If you find any issues, please report a GitHub issue to the issue repository to get help.
2.Welcome to the developer discussion group as well: MoveAnalyzer.