Ethereum Vyper language support for Visual Studio Code
Marketplace: ext install tintinweb.vscode-vyper
Also available on vscode.dev! (compilation not yet supported)
Note: Active features can be disabled by setting Settings
→ Vyper
→ Mode: Active
to false
.
Settings
→ Vyper
→ Decoration: Enable
)Settings
→ Vyper
→ Hover: Enable
)Settings
→ Vyper
→ Compile: On Save
)cmd + shift + p
→ Vyper: Compile
)vyper
is in PATH
) (Settings
→ Vyper
→ Command
)pip3 install vyper
). In case vyper is not available in path or called in a virtualenv configure the vyper command in Settings
→ Vyper
→ Command
constructor
, fallback
function, methods
, structs
, ... as you type. Select the snippet from the suggestion box. See snippets/ for a list of available snippets.Q: I get an error running vyper on my macbook with M1/M2 chipset.
A: The extension executes the vyper compiler in a /bin/sh
shell that may not have all the customizations you are using in your day-to-day shell/terminal. As a workaround, I suggest to set the setting:vyper.command
to arch -x86_64 vyper
. see #18
Q: My project uses Vyper 0.3.x and import some interfaces from other contracts. but the extension does not recognize them and output FileNotFoundError: Cannot locate interface 'interface/my_interface{.vy,.json}
.
A The extension compiles your file with the command vyper
. You should set the setting: vyper.command
to vyper -p path/to/your/project/directory
to make the compiler aware of the interfaces in your project.
Q My multi-module project uses Vyper 0.4.x and while the extension does not report compilation error for any files, when compiling the project with the Vyper cli or some framework such as ape
, foundry
or titanoboa
, it fails with some issue about modules usage/initialization.
A In 0.4.x, A Vyper modules might be valid when being imported but not a valid standalone contracts to compile into bytecode. Hence the extension stops the compilation at the `annotated_ast
phase, before the global constraint checker. For more info see https://github.com/vyperlang/vyper/pull/3810.
pip3 install vyper
./scripts/fetch_vyper_language_spec.py
or run npm run fetchGrammar
to merge the python tmlanguage spec with vyper language specifics.see CHANGELOG