LaunchDarkly extension for GitHub Copilot

The LaunchDarkly extension for GitHub Copilot is available to customers on select plans

The LaunchDarkly extension for GitHub Copilot on Visual Studio Marketplace is available only in conjunction with the LaunchDarkly VSCode extension. The VSCode extension is only available to customers on select plans. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Overview

The LaunchDarkly extension for GitHub Copilot on Visual Studio Marketplace provides GitHub Copilot functionality for managing the lifecycle of a feature flag from within Visual Studio Code (VSCode).

To enable @LaunchDarkly commands in GitHub Copilot, confirm that you are using the latest version of VSCode and that you are using the GitHub Copilot Chat extension for VSCode.

In your GitHub Copilot prompt, you can use the following @LaunchDarkly commands:

CommandDefinitionExample
@LaunchDarkly /createFlagGitHub Copilot creates a LaunchDarkly feature flag based on your prompt@LaunchDarkly /createFlag I need a new feature flag for the account-migration project
@LaunchDarkly /explainGitHub Copilot asks you to select a flag, and then provides a summary of the flag, its variations, and its release pipeline status. If the flag is ready for cleanup, the summary will mention that, and the Problems tab will include a message that the flag is ready for cleanup.@LaunchDarkly /explain
@LaunchDarkly /cleanupGitHub Copilot asks you to select a flag, and then determines whether or not the selected flag is ready for cleanup. It provides details on each criteria that must be met. To learn more about when a flag can be archived, read Archiving flags.@LaunchDarkly /cleanup

Flag Actions command

Use the LaunchDarkly: Flag Actions command to bring up a menu of options that you can choose from to interact with your feature flags.

Dashboard Shortcuts command

Use the LaunchDarkly: Dashboard Shortcuts command to open a list of your shortcuts for the configured project.

Code references in the VSCode extension

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

Flag searches across the workspace also include flag references.

Quick targeting in the VSCode extension

The LaunchDarkly VSCode extension supports quick targeting. This is useful if you use a consistent targeting context key or rule when coding with feature flags.

It will look for a yaml file, rules.yaml, located in the .launchdarkly subdirectory of your home directory. The full path is: ~/.launchdarkly/rules.yaml.

Here’s an example:

Example Targeting YAML
1targets:
2 - name: Target Me in Context
3 values: example-context-key
4 - name: Target Me in Account Context
5 contextKind: account
6 values: account-1234
7rules:
8 - name: My Test Organization
9 clauses:
10 - contextKind: user
11 attribute: organization
12 op: in
13 negate: false
14 values:
15 - org-1234

Targets

You can define targets with the following attributes:

  • Name: A descriptive name for the target.
  • ContextKind (Optional): The kind of context for account-related targeting, for example, account. If not provided, defaults to user.
  • Values: An array of specific keys or identifiers for targeting.

Rules

Rules are conditions set for targeting. Each rule has:

  • Name: A descriptive name for the rule.
  • Clauses: Conditions under which this rule applies. Each clause can specify:
    • ContextKind: The context kind, such as user, to which the clause applies.
    • Attribute: The specific attribute within the context to evaluate, such as organization.
    • Operation (op): Defines the operation to apply for the clause’s condition. Supported operations include: in, endsWith, startsWith, matches, contains, lessThan, semVerEqual, semVerLessThan, semVerGreaterThan, before, and after.
    • Negate: A boolean indicating if the condition should be inverted. If true, the rule applies when the condition is not met.
    • Values: An array of values to compare the attribute against based on the operation.

Telemetry

LaunchDarkly collects information about your use of this extension in accordance with the LaunchDarkly privacy policy.

You can opt out at any time in the extension settings by navigating to LaunchDarkly > Enable Telemetry and unchecking the box. We also respect the VSCode Telemetry setting.