Skip to main content

Styra Link with VS Code

Styra Link is an opinionated workflow for writing, testing, and validating your policy locally as an integrated part of your development. Styra Link is available as part of the Styra CLI.

The Styra VS Code extension provides access to some of the Styra Link tools directly in VS Code. For example, on the command line, you use styra link init to create a Styra DAS project. In the Styra VS Code extension, you would open the command palette using Cmd + Shift + P and invoke the Styra Link: Initialize... command to create a Styra DAS project.

note

The Styra VS Code extension automatically installs and updates the Styra CLI.

When you run commands within the Styra VS Code extension, commands that require several inputs show you a flow diagram, so you have a better understanding of the process. The following figure shows an example for the Styra Link: config git… command.

Styra Visual Studio Code Extension Flow DiagramStyra Visual Studio Code Extension Flow Diagram

The extension automatically reveals the underlying Styra Link command it executes, so you can easily run it on the command line or in a script. You can see additional details if you toggle the Styra: Debug setting in VS Code, including the Styra DAS API calls shown in the following screenshot.

Styra Visual Studio Code Extension DiagnosticsStyra Visual Studio Code Extension Diagnostics

note

Once you install the VS Code extension, the Styra page in your list of extensions provides some operational details (available commands, settings, etc.)The Styra VS Code extension automatically installs and updates the Styra CLI upon first use.