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!

2 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"
1 Like

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).

1 Like

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.

1 Like

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
1 Like

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.

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

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

1 Like

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).

OMG, there are two of us :face_holding_back_tears:

1 Like

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

1 Like

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.

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

1 Like

Wow. That would be great help.

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