-
Notifications
You must be signed in to change notification settings - Fork 17
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
Experiment: Viper integration #78
base: master
Are you sure you want to change the base?
Conversation
A few more materials:
On establishing connection Content-Length: 85
{ "jsonrpc": "2.0", "id": 1, "method": "initialize","params": { "processId": null}} On Viper program creation/updates Content-Length: 173
{ "jsonrpc": "2.0", "method": "textDocument/didOpen","params": { "textDocument": { "languageId": "viper","version": 0,"uri": "file:///Users/ggreif/motoko/post-fail.vpr"}}}
Content-Length: 137
{ "jsonrpc": "2.0", "method": "textDocument/didSave","params": { "textDocument": {"uri": "file:///Users/ggreif/motoko/post-fail.vpr"}}} Asking for verification Content-Length: 274
{ "jsonrpc": "2.0", "id": 1, "method": "Verify","params":{"uri":"file:/Users/ggreif/motoko/post-fail.vpr","backend":"silicon","customArgs":"--z3Exe /nix/store/3dpbapw0ia9q835pqbf7khdi9rps2rm2-z3-4.8.15/bin/z3 /Users/ggreif/motoko/post-fail.vpr","manuallyTriggered":false}} Here You may get a request asking for file endings ( Content-Length: 66
{ "jsonrpc": "2.0", "id": 1, "result":{"fileEndings":["*.vpr"]}} A You'll see something like this: {"jsonrpc":"2.0","method":"StateChange","params":{"newState":6,"progress":-1.0,"success":4,"verificationCompleted":1.0,"manuallyTriggered":1.0,"filename":"post-fail.vpr","time":3.346,"verificationNeeded":-1.0,"uri":"file:///Users/ggreif/motoko/post-fail.vpr","error":"","diagnostics":[{"range":{"start":{"line":3,"character":12},"end":{"line":3,"character":17}},"severity":1,"source":"","message":"Postcondition of bar might not hold. Assertion foo() might not hold. ([email protected])"}]}} |
Btw. If you start
|
package.json
Outdated
"compile": "rimraf ./out && tsc -p .", | ||
"vscode:prepublish": "npm run generate && npm run compile", | ||
"generate": "npm run download && cd ../motoko && nix-shell --command 'make -C src moc.js' && cp -vL src/moc.js ../vscode-motoko/src/generated", | ||
"download": "curl -L -o src/generated/viperserver.jar https://github.com/viperproject/viperserver/releases/download/v-2022-10-18-0728/viperserver.jar -C -", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use $VIPER_SERVER
in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea; now using the Nix environment for the stand-in portable build logic.
Progress:
In this screenshot, the |
While installing the extension from this branch, I've experienced the following minor hick-ups:
The rest of the instructions worked out nicely! PS. I ran |
Also, one probably needs |
An you mean create (not run) src/generated. |
Fixed; thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few minor suggestions.
by adding more commands
* Bump compiler version * Patch viperTools path for WSL environment * 0.0.4 * Remove unused import * 0.1.0
…esting (#281) * first * Use built-in 'moc.js' * Reduce diff * Bump version * Bump 'motoko' npm package --------- Co-authored-by: rvanasa <[email protected]>
VS Code support for dfinity/motoko#3477.
moc.js
(rather than the OCaml LSP) to generate Viper files.moc
ordfx
installation.// @verify
at the top of a Motoko file.Example (
Main.mo
):Generated file (
Main.vpr
):Recommended editor workflow using split-screen tabs (updates as you type):
Steps to build the extension:
motoko
andvscode-motoko
are in the same parent directoryryan/viper
branch in the Motoko compiler repositorycd vscode-motoko
and thennpm run package
(this will rebuildmoc.js
)/vscode-motoko-*-viper.vsix
file and select "Install extension VSIX"Progress:
Pipeline.viper_files