Move 2024 IDE support

We have just published a new VSCode Move plugin to the Visual Studio Marketplace (Move - Visual Studio Marketplace). It supports the upcoming Move 2024 features and has some nice improvements over the original move-analyzer (e.g., it is now super easy to install!), but it is still in the “Preview” state with a lot more cool features coming in the near future. Please check it out and let us know what you think - we could really use your feedback to continue improving it!

3 Likes

Getting error:

parse manifest '"/Users/fastfrank/frankc01/sui-track" 'failed. addr must exactly 32 length or start with '0x' like '0x2' Error parsing '[package]' section of manifest Caused by: Invalid 'edition'. Unsupported edition "2024.beta". Current supported editions include: "legacy", "2024.alpha"

Here is my move.toml

[package]
name = "SuiTrack"
version = "0.0.2"
edition = "2024.beta"

[dependencies]
# Assuming the `sui` repository is at the same level as the package parent directory
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" }

[addresses]
suitrack = "0x0"
2 Likes

The new extension listed above should fix this as it provides support for Move 2024. You should uninstall the old extension (and any move-analyzer you may have already installed) and install the new one (which bundles the move-analyzer and installs it automatically).

2 Likes

Ok, I uninstalled anything that was related to Move and reinstalled (version 0.0.2) and while the original error is gone there there are warnings about not recognizing ‘version’ or ‘published-at’. You are probably aware but figured you wouldn’t mind the feedback.

2 Likes

These warnings should not be generated by the new extension. They indicate an older version of the package system (as of months ago) and the extension is using a much newer one that has support for these manifest file fields. Here are the extra steps I would try to make sure that the previously installed move-analyzer extension is not interfering with the new one (I am assuming you did not change any configuration options for the new extension):

  1. Quit the VSCode
  2. Uninstall the new extension (I am assuming the old one is uninstalled)
  3. Remove the old extension’s directory (~/.vscode/extensions/move.move-analyzer-0.0.10)
  4. Remove the new extension’s directory (~/.vscode/extensions/mysten.move-0.0.2)
  5. Remove move-analyzer binary from ~/.sui/bin
  6. Start VSCode
  7. Install new extension
  8. Restart VSCode
2 Likes

Actually, I take it back (and apologize…). I indeed see these warnings as well (will investigate!). I am leaving the re-install instructions here, though, as they may be useful in case other folks have some install/upgrade issues.

1 Like

Yes, followed uninstall and same issue but you caught that as well.

1 Like

I use move-analyzer from Emacs. Is there a CLI version of this new plugin so that I can test it with Emacs?

2 Likes

You can install just the (new) move-analyzer binary using:

cargo install --git https://github.com/MystenLabs/sui.git move-analyzer

Instructions are also included in Enacs’s move-mode README (@amnn recently updated it to support Move 2024).

1 Like

OMG, there are two of us :face_holding_back_tears:

2 Likes

BTW. I am working on move-ts-mode also. Targeting Emacs 30 for inclusion.

2 Likes

Excellent! We do have a Move 2024 compatible tree-sitter grammar somewhere. I’ve mentioned this post to Tim who worked on that most recently, so that he can share more details on it here.

1 Like

We do have a tree-sitter implementation that supports Move 2024 here: https://github.com/tzakian/tree-sitter-move (can’t seem to include links :cry:).

Also, I’m unsure if Emacs uses tree-sitter queries for syntax highlighting (I believe it does though?). If it does this is the current queries.scm file that I use for nvim-based tree-sitter highlighting using the tree-sitter implementation above

;; Highlights file for Move

;; Types
(type_parameters) @type
(type_parameter) @type
(type_parameter_identifier) @type
(apply_type)  @type
(ref_type)  @type.ref
(primitive_type) @type.builtin

;; Comments
(line_comment) @comment
(block_comment) @comment

;; Annotations
(annotation) @annotation
(annotation_item) @annotation.item

;; Constants
(constant name: (constant_identifier)  @constant.name)
(constant expr: (num_literal)  @constant.value)
((identifier) @constant.name
 (#match? @constant.name "^[A-Z][A-Z\\d_]+$'"))

;; Function definitions
(function_definition name: (function_identifier)  @function)
(macro_function_definition name: (function_identifier)  @macro)
(native_function_definition name: (function_identifier)  @function)
(usual_spec_function name: (function_identifier)  @function)
(function_parameter name: (variable_identifier)  @variable.parameter)

;; Module definitions
(module_identity address: (module_identifier)  @namespace.module.address)
(module_identity module: (module_identifier)  @namespace.module.name)

;; Function calls
(call_expression access: (module_access module: (module_identifier)  @namespace.module.name))
(call_expression access: (module_access member: (identifier)  @function.call))


(label (identifier)  @label)

;; Macro calls
(macro_call_expression access: (macro_module_access) @macro.call)

;; Literals 
(num_literal) @number
(bool_literal) @boolean
(hex_string_literal) @string.hex
(byte_string_literal) @string.byte
(address_literal) @number.address

;; Binders

;; Uses 
(use_member member: (identifier)  @include.member)
(use_module alias: (module_identifier) @namespace.module.name)

(use_fun (module_access module: (module_identifier)  @namespace.module.name))
(use_fun (module_access member: (identifier)  @include.member))

(function_identifier) @function.name

;; Friends 
; (friend_access local_module: (identifier)  @namespace.module.name)

;; Structs
(struct_definition name: (struct_identifier)  @type.definition.struct)
(ability) @type.ability
(field_annotation field: (field_identifier)  @field.identifier)
(field_identifier) @field.identifier

;; Enums
(enum_definition name: (enum_identifier)  @type.definition.struct)
(variant variant_name: (variant_identifier)  @constructor.name)

;; Packs
(pack_expression access: (module_access)  @constructor.name)

;; Unpacks
;; TODO: go into variants
(bind_unpack (module_access)  @type.name)
(module_access "$" (identifier)  @macro.variable)
"$"  @macro.variable

(module_access module: (module_identifier)  member: (identifier) @constructor.name)

;; Lambdas
(lambda_bindings (bind_var (variable_identifier)  @variable.parameter))


;; Operators
(binary_operator) @operator
(unary_op) @operator
"=>" @operator
"@" @operator
"->" @operator

;; Specs
(spec_block target: (identifier)  @function.spec.target)
(spec_pragma) @preproc.annotation.spec
(spec_condition kind: (condition_kind) @condition.spec)
(condition_properties) @preproc.spec.condition.properties

; (match_expression "match") @keyword

;; Spec keywords
; "opaque" @keyword
; "aborts_if" @keyword
; "abstract" @keyword
[
 "pragma" 
] @keyword

;; Source Language Keywords
[
 "fun" 
 "return" 
 "if" 
 "else" 
 "while" 
 "native" 
 "struct" 
 "use" 
 "public" 
 "public(package)" 
 "public(friend)" 
 "spec" 
 "module" 
 "abort" 
 "const" 
 "let" 
 "has" 
 "as" 
 "&" 
 "&mut" 
 "abort" 
 "friend" 
 "entry"
 "mut"
 "macro"
 "enum"
 "break"
 "continue"
 "loop"
] @keyword

 "match" @keyword

3 Likes

Wow. That would be great help.

1 Like

Thanks for sharing this. I was using this GITHUB/tree-sitter-grammars/tree-sitter-move/blob/saving/grammar.js.

1 Like

Is there a tree sitter available to use sui-move in vim/neovim?

1 Like

What’s the difference between the following two versions of move-analyzer? Which one is recommended?

cargo install --git https://github.com/MystenLabs/sui.git move-analyzer

and the one from https://github.com/movebit/move (I can’t include links) ?

Mysten Labs actively develops, maintains, and recommends Move VSCode extension which you can find in the VSCode marketplace here as stated in the original post. This extension does not require manual installation of the move-analyzer binary, but you can install it locally (e.g., for integration with other code editors) by invoking:

cargo install --git https://github.com/MystenLabs/sui sui-move-lsp

You can consult extension’s README in the VSCode marketplace for additional details.

The command-line you listed will install an older version of Mysten’s move-analyzer which is no longer recommended. The project at https://github.com/movebit/move is another version of move-analyzer, developed externally by MoveBit. I am not sure about the extent of this solution’s support for Move 2024 features nor the level of support MoveBit currently provides.

I’m not using VS Code. I’m using emacs.
So, should I install cargo install --git https://github.com/MystenLabs/sui sui-move-lsp? Is it the same as ./move-analyzer that comes with Sui releases?

Yes, that’t the same one that’s coming with Sui release and you can grab it as well from the Sui release testet binaries on this page, though of course if you build from sources you will get the most recent version (at this point, though, the most recent testnet release should contain all the most recent changes).