tintinweb/vscode-vyper

Command 'Vyper: Compile' resulted in an error (command 'vyper.compileContract' not found)

Closed this issue · 11 comments

I'm getting this error when trying to compile a vyper contract in VS Code with the tintinweb vyper extension.

Command 'Vyper: Compile' resulted in an error (command 'vyper.compileContract' not found)

My setup:
Python 3.8.6
Vyper 0.2.5+commit.a0c561c
VS code 1.50
Windows 10

Vyper is in my user path (running windows 10) and can be called directly if I open a terminal.
I installed Vyper through pip install vyper.

[edit]
I don't use a virtual environment, as this is the only python / vyper project I'm doing on the machine
[/edit]

It also gives a source path error, with a leading /

image

I've deleted the extension folder named tintinweb.vscode-vyper-0.0.9 in VScode and also deleted it from my %user_profile%.vscode\extensions folder

It seems there are a couple of errors, scenarios below:

  1. Vyper: Compile from the command palette:

[Compiler Exception] TypeError: Cannot read property 'toString' of undefined

I can not reproduce this outside of vsCode

  1. Saving a Vyper file:
    [Compiler Error] OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: "''\c:\temp\Scratches\banana.vy''"
    I can reproduce this on the command line. (see below).
    image

Hey @DataBeast-IT,

thanks for reporting this issue.

I think the problem is that I am passing the uri.path instead of the filesystem path to the compiler. on *nix/macos this is actually the same that's why I don't see the error here. on windows it is different.

I believe this should be fairly easy to fix. Would you be down to testing the release candidate before I publish it to confirm that this is fixed?

Sure!

How do I do that? ;-)

@DataBeast-IT here's a preview: vscode-vyper-0 0 10 vsix

  • download
  • rename from png to .vsix and install in vscode.

let me know if that fixes your problem.

I will check it on windows after the weekend, I have no access to that box at the moment.

Below is Linux!
(should this be splitted in a windows an linux issue btw?)
Just to make sure it still works on ubuntu I tried your 0.0.10 extension on my ubuntu 20 box.

2 scenario's:

  1. altering a .vy file, doing CTRL+S to save does not give a popup or error message.
    I'm not sure if it compiled at all.

  2. using command palette doing Vyper:Compile gives this error
    [Compiler Exception] TypeError: Cannot read property 'toString' of undefined

after uninstalling the 0.0.10 version, deleting it from .vscode/extensions and reinstalling 0.0.9 the compile on save function works again.
Going through the menu tells me
[Compiler Exception] TypeError: Cannot read property 'toString' of undefined

Generic question: When I compile, where does the compiled contract end up? No file is created in any directory. I checked /usr/local/bin where the vyper executable is located. Nothing to be found.

Generic question: When I compile, where does the compiled contract end up? No file is created in any directory. I checked /usr/local/bin where the vyper executable is located. Nothing to be found.

we take output artifacts from stdout.

the vsix I shared with you previously was broken. I've fixed a couple of issues, briefly tested it on windows, and repackaged it. Please try this one @DataBeast-IT:

vscode-vyper-0 0 10 png -> vsix

On the windows box:

  • saving a changed .vy gives a [compiler success] popup
  • using the command palette doing Vyper:compile gives the same popup

So that is working now 👍

Observations:

  • on opening a .vy file, the extension compiles the smart contract right away and shows the popup.
  • there is no output file created, debug / output windows in VScode show nothing. Within the open folder there are no new files.

How do I find my output? I tried adding some vyper parameters. It still compiles but nothing changes.
image

we currently dont save these artifacts. the compile step is basically used to detect if there are any compile-time issues with your code.

happy to implement that though, shouldn't be a lot of work.

Ah ok! That makes sense!

Thanks for your help!

fixed in #5

feel free to open a new issue if you want the extension to actually output bytecode somehow.

cheers and thanks for testing!