npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vscode-motoko

v0.9.0

Published

Motoko language support

Downloads

5

Readme

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:

  • 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 quick-fix options.
  • Go to definition (F12): jump to the definition of a local or imported identifier.
  • IntelliSense (Ctrl + Space): view all available autocompletions and code snippets.

Snippets

Other Features

  • Vessel and MOPS (the two most popular 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 or principal-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 config files.
  • View type information and documentation by hovering over function names, imports, and other expressions.

Tooltips

Commands

  • Motoko: Restart language server: Starts (or restarts) the language server

Settings

  • motoko.dfx: The location of the dfx binary
  • motoko.canister: The default canister name to use in multi-canister projects
  • motoko.formatter: The formatter used by the extension
  • motoko.legacyDfxSupport: Uses legacy dfx-dependent features when a relevant dfx.json file is available

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
    }
  }
}

Recent Changes

Projects using dfx >= 0.11.1 use a new, experimental language server.

To continue using the original language server, you can modify your dfx.json file to use version 0.11.0 or earlier:

{
  "dfx": "0.11.0"
}

If you encounter any bugs, please open a GitHub issue with steps to reproduce so that we can fix the problem for everyone.

Contributing

Set up your local development environment:

Ensure that Node.js >= 14.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.