Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Fix minor issues to enable Serokell to use the IDE for local testing #281

Draft
wants to merge 1 commit into
base: viper
Choose a base branch
from

Conversation

aterga
Copy link
Collaborator

@aterga aterga commented May 22, 2024

How to use this fix:

  1. Make sure you have the "Viper v4.3.1" extension installed in VS Code, and that it has installed its dependencies (this happen via a prompt when you open e.g., an empty Viper file in VS Code with this extension installed). Verifying Viper files should work automatically upon saving .vpr files.

  2. Setup the VS Code extension repo as follows:

git clone https://github.com/dfinity/vscode-motoko -b arshavir/serokell-ide-quick-fix
cd vscode-motoko
npm install
cd ..
  1. Compile your custom version of the Motoko compiler into JS:
git clone https://github.com/serokell/motoko
cd motoko
nix-build -A js

This should print something like /nix/store/x7amwi31gzavs8r7q89ljwwaksg5kqzw-moc.js (which is a directory). Copy the internal JS file into a place that would be seen by the VS Code extension, e.g.:

cp /nix/store/x7amwi31gzavs8r7q89ljwwaksg5kqzw-moc.js ../vscode-motoko/src/generated/moc.js
  1. Open the workspace in VS Code (e.g., code .) and enter a debug session (e.g., hit F5 or click play in the Run and Debug panel of VS Code):

Screenshot 2024-05-22 at 19 46 15

  1. In the new window, open a folder (a.k.a. workspace) containing some Motoko-san source files. For example, open "motoko/test/viper/".

  2. Choose one Motoko-san source file, e.g., "reverse.mo", from your workspace.

  3. Ensure that you have // @verify on the very first line of the file (this tells the motoko-san extension that it needs to try to verify this file).

  4. Upon assertion violation, you should see some interactive feedback from the tool upon saving the file, e.g.:

Screenshot 2024-05-22 at 19 52 33

// import getMotoko from 'motoko/lib';
import mo from 'motoko';
import getMotoko from 'motoko/lib';
// import mo from 'motoko';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, these changes would need to be removed before merging this. But they are helpful for local development, so let's keep them in the unmerged PR until Serokell's contributions are merged into moc.

I'll change the PR title to indicate it's not supposed to be merged just yet.

@aterga aterga changed the title Fix minor issues to enable Serokell to use the IDE for local testing Draft: Fix minor issues to enable Serokell to use the IDE for local testing May 23, 2024
@ggreif ggreif marked this pull request as draft May 24, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants