Kadena provides a Visual Studio Code extension to streamline your smart contract development experience with Pact. Before installing the extension, make sure that you have installed Pact, as well as Pact Language Server.
Open Visual Studio Code and click the Extensions icon in the Activity Bar on the
far left of the window. In the sidebar that pops op, search for "Pact". Install
the "PACT - PACT Programming Language" extension. During installation of the
extension, you may be prompted to install additional extension required by the
Pact extension. Install the additional extension to enjoy the full functionality
of the Pact extension. Open the Visual Studio Code settings and search for
"Pact". Configure the path to the Pact executable and the Pact Language server
executable. Or just use
pact-lsp respectively if you added the
executables to your
Check the "Enable trace" box in the Pact extension settings to enable the output
trace for Pact. Everytime you save a file, the
pact command will run with the
-t flag when this setting is enabled, providing you detailed line by line
.repl file execution.
Check the "Enable LSP" box in the Pact extension settings to enable the Pact
Language server. With this setting enabled, you syntax errors will be
.pact files and problems will be reported in the Status Bar and
Bottom Panel of the Visual Studio Code window.
Check the "Enable coverage" box in the Pact extension settings to enable code
coverage reporting for
.repl files. Everytime you save a
file, code coverage will be calculated for the respective file and all the
.repl files that it loads. Covered lines will be highlighted in
green in your editor and uncovered lines will be highlighted red. To view a code
coverage report in HTML format, right-click the
file relative to the file that was run. Click "Show preview" to open the report.
To run all your
.repl files at once, simply create an entrypoint
that loads all the other
.repl files in your project. Open the entrypoint file
and save it to run all your tests.