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

Merged
merged 5 commits into from
Jul 16, 2024

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we ready to merge? I can take over releasing these changes if it would be beneficial for the upcoming demo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are we ready to merge?

From my p.o.v., we're ready to merge!

@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
Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

LGTM!

@rvanasa rvanasa marked this pull request as ready for review July 16, 2024 15:45
@rvanasa rvanasa merged commit e45ff0d into viper Jul 16, 2024
@rvanasa rvanasa deleted the arshavir/serokell-ide-quick-fix branch July 16, 2024 16:06
@rvanasa
Copy link
Contributor

rvanasa commented Jul 16, 2024

Updated the extension on the VS Code marketplace. Let me know if you encounter any issues or if we need any other last-minute changes.

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.

3 participants