• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""
EXPAND ALL

EDIT ON GITHUB

Visual Studio Code (VSCode)

Read time: 1 minute
Last edited: Dec 15, 2021
The VSCode extension is a Pro and Enterprise feature

The VSCode extension is available to customers on a Pro or Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Overview

This topic explains how to use the LaunchDarkly VSCode extension to interact with feature flags from within Visual Studio Code (VSCode).

With the extension, you'll get the ability to:

  • See a tooltip with feature flag details when you hover over a feature flag key in your source code
  • Autocomplete feature flag keys
  • Open feature flags in LaunchDarkly (Default keybinding: ctrl+alt+g/⌘+alt+g)
  • View a list of feature flags and their settings in the Explorer view
  • Update a flag's on/off state, fallthrough value, and off variation
  • Enable codelens for flags in your source code
The LaunchDarkly VSCode extension
The LaunchDarkly VSCode extension
Treeview right click options
Treeview right click options

Installing the VSCode extension

To install the VSCode extension, visit the Visual Studio Marketplace.

Configuration

To configure the VSCode extension, you must have a valid access token.

You can create a new access token on the Authorization page. The access token must have sufficient permissions to support the extension's functionality.

The following is an example policy which allows reader access to all projects and writer access to the minimal set of fields the extension is able to update:

[
{
"resources": ["proj/*"],
"actions": ["viewProject"],
"effect": "allow"
},
{
"resources": ["proj/*:env/*:flag/*"],
"actions": ["updateOn", "updateFallthrough", "updateOffVariation"],
"effect": "allow"
}
]

After you install the LaunchDarkly extension, VSCode prompts you to configure it:

  1. Provide an access token for your LaunchDarkly account. This access token must have sufficient permission as described above.
  2. Select your corresponding LaunchDarkly project.
  3. Select your corresponding LaunchDarkly environment.
  4. Select whether you want the extension to work with all VSCode workspaces or just the current workspace.

You can reconfigure the extension at any time by running the "LaunchDarkly: Configure" command from the command palette (ctrl+shift+p/⌘+shift+p).

Code references in the VSCode extension

The LaunchDarkly VSCode extension supports code references. If you use code references, configuring aliases makes the informational hover card available wherever an alias appears in your code. Aliases appear under the flag entry in the Explorer view. To learn more, read Finding flag aliases.

Flag searches across the workspace also include flag references.