Home

Awesome

Motoko · VS Code Extension

Motoko language support for Visual Studio Code.

Visual Studio Marketplace PRs Welcome

Overview

Motoko is a high-level smart contract language for the Internet Computer.

This IDE extension provides type checking, formatting, snippets, and more for Motoko canister development.

Showcase

Installation

Get this extension through the VS Marketplace, or alternatively the Extensions panel in your VS Code project.

VSCodium users can download the extension through Open VSX or the GitHub releases page.

Keyboard Shortcuts

Below are the default key bindings for commonly used features supported in the extension:

Snippets

Other Features

Tooltips

Commands

Motoko Playground deployment

Settings

Advanced Configuration

If you want VS Code to automatically format Motoko files on save, consider adding the following to your settings.json configuration:

{
  "[motoko]": {
    "editor.defaultFormatter": "dfinity-foundation.vscode-motoko",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
  }
}

Contributing

Set up your local development environment:

Ensure that Node.js >= 16.x and Cargo are installed on your system.

git clone https://github.com/dfinity/vscode-motoko
cd vscode-motoko
npm install

Run unit tests:

npm test

Build the extension:

npm run package

This generates a file named vscode-motoko-*.*.*.vsix in the project root.

Install in VS Code:

code --install-extension vscode-motoko-*.*.*.vsix

Alternatively, right-click the .vsix file and then select the "Install Extension VSIX" option.


Community PRs are welcome! Be sure to check the list of open issues in case anything catches your eye.