Motoko Visual Studio Code extension
Visual Studio Code (VS Code) is a widely used open source IDE that supports canister development in Motoko.
The Motoko VS Code extension enhances the development experience by providing features such as type checking, code formatting, autocompletion, go-to-definition, code snippets, and more, making it easier to build, navigate, and manage Motoko-based canisters.
Installation
Install the extension through the VS Marketplace, or alternatively the Extensions panel in your VS Code project.
VSCodium users can download the extension from Open VSX or the GitHub releases page.
Keyboard shortcuts
Below are the default key bindings for commonly used features supported in the extension:
- Code formatter (
Shift
+Alt
+F
): Format a Motoko file using prettier-plugin-motoko. - Organize imports (
Shift
+Alt
+O
): Group and sort imports at the top of your Motoko file. - Import code action (
Ctrl/Cmd
+.
while hovering over an unresolved variable): Show import quick-fix options. - Go to definition (
F12
): Jump to the definition of a local or imported identifier. - IntelliSense (
Ctrl
+Space
): View all available auto-completions and code snippets.
Other features
- The Mops and Vessel Motoko package managers are supported out-of-the-box in this extension.
- Quickly convert between Motoko types using code snippets such as
array-2-buffer
orprincipal-2-text
. - In case you're hoping to learn Motoko without installing
dfx
, the Motoko VS Code extension works standalone on all major operating systems (including Windows). - This extension also provides schema validation and autocompletion for
dfx.json
configuration files. - View type information and documentation by hovering over function names, imports, and other expressions.
- Deploy temporary canisters to the ICP mainnet directly from the editor.
Contributing
The Motoko VS Code extension is completely open source and available on GitHub.