This extension integrates Cadence, the resource-oriented smart contract programming language of Flow, into Visual Studio Code. It provides features like syntax highlighting, type checking, code completion, etc.
Note that most editing features (type checking, code completion, etc.) are implemented in the Cadence Language Server.
- Must have Typescript installed globally:
npm i -g typescript
- Run the Typescript watcher:
tsc -watch -p ./
- Launch the extension by pressing
F5
in VSCode - Manually reload the extension host when you make changes to TypeScript code
1{2"version": "0.2.0",3"configurations": [4{5"type": "extensionHost",6"request": "launch",7"name": "Launch Extension",8"runtimeExecutable": "${execPath}",9"args": ["--extensionDevelopmentPath=${workspaceFolder}"],10"outFiles": ["${workspaceFolder}/out/**/*.js"]11}12]13}
- Syntax highlighting (including in Markdown code fences)
- Run the emulator, submit transactions, scripts from the editor
To install the extension, ensure you have VS Code installed
and have configured the code
command line interface.
The recommended way to install the latest released version is to use the Flow CLI.
1brew install flow-cli
Check that it's been installed correctly.
1flow version
Next, use the CLI to install the VS Code extension.
1flow cadence install-vscode-extension
Restart VS Code and the extension should be installed!
If you are building the extension from source, you need to build both the extension itself and the Flow CLI (if you don't already have a version installed). Unless you're developing the extension or need access to unreleased features, you should use the Flow CLI install option (above). It's much easier!
If you haven't already, install dependencies.
1npm install
Next, build and package the extension.
1npm run package
This will result in a .vsix
file containing the packaged extension.
Install the packaged extension.
1code --install-extension cadence-*.vsix
Restart VS Code and the extension should be installed!