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.
- The Remote-WSL extension splits VS Code into a “client-server” architecture, with the client (the user interface) running on your Windows machine and the server (your code, Git, plugins, etc) running remotely.
- How to update to the latest release. The following shows you how to update to the latest release of Visual Studio Code. Note: For Mac and Windows users, we have enabled the auto-update channel.
Note that most editing features (type checking, code completion, etc.) are implemented in the Cadence Language Server.
Brew tap azure/functions brew install azure-functions-core-tools@3 # if upgrading on a machine that has 2.x installed brew link -overwrite azure-functions-core-tools@3 v2.x brew tap azure/functions brew install azure-functions-core-tools@2 If you don't plan to use extension bundles, install the.NET Core 3.x SDK for macOS.
Developing the Extension
Pre-requisites
- Must have Typescript installed globally:
npm i -g typescript
Getting Started
- 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
Configuration for Extension Host if Missing (launch.json
):
Features
- Syntax highlighting (including in Markdown code fences)
- Run the emulator, submit transactions, scripts from the editor
Installation
To install the extension, ensure you have VS Code installedand have configured the code
command line interface.
Using the Flow CLI
The recommended way to install the latest released version is to use the Flow CLI.
Check that it's been installed correctly.
Next, use the CLI to install the VS Code extension.
Restart VS Code and the extension should be installed!
Building
If you are building the extension from source, you need to build both theextension 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!
Vscode Breakpoint
VS Code Extension
If you haven't already, install dependencies.
Next, build and package the extension.
This will result in a .vsix
file containing the packaged extension.
Install the packaged extension.
Restart VS Code and the extension should be installed!
VSCode is the primary way to edit and debug PowerShell scripts on Mac OS and Linux. If you do not have it yet, follow these instructions on GitHub on installing VSCode on Mac OS/Linux/Windows and adding its PowerShell extension.
Once you are done with that, you can create a new or open an existing PS1 file, however, you might still get “No suggestions” error when you try to get intellisense for cmdlets:
This is because this functionality actually requires OpenSSL. Here’s how you add it to your system:
Install Homebrew
Homebrew is Mac’s most popular package manager. To install it:
- Open a Terminal window,
- Install Mac OS command-line developer tools (xcode) by pasting the following command and pressing Enter:
xcode-select --install
- Install Homebrew package manager by pasting the following command:
ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'
- Double-check that the installation is successful by running
brew doctor
Linux Brew Vscode
Install OpenSSL
Now install OpenSSL on Mac OS by simply pasting the following command to the Terminal window:
Vscode Breakpoint Python
brew install openssl
Vscode Brewing
Verify PowerShell cmdlet intellisense in VSCode
Vscode Brewery
- Start VSCode,
- Open a ps1 file or save the file that you have as .ps1,
- Verify that PowerShell is selected as the language mode at the bottom right of the VSCode window:
- Type
Get-
and you will see the intellisense window popping up with the list of available Get- cmdlets: