> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LaunchDarkly extension for GitHub Copilot

<View title="Developer" />

<View title="Federal docs">
  <Danger>
    **This extension is not available in federal environments**

    To learn more, read <a href="/docs/home/infrastructure/federal">LaunchDarkly in federal environments</a>.
  </Danger>
</View>

<View title="EU docs">
  <Danger>
    **This extension is not available in LaunchDarkly's European Union (EU) instance**

    To learn more, read <a href="/docs/home/infrastructure/eu">LaunchDarkly in the European Union (EU)</a>.
  </Danger>
</View>

<Note>
  **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](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/).
</Note>

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)](/docs/home/getting-started/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:

<table>
  <thead>
    <tr>
      <th>Command</th>
      <th>Definition</th>
      <th>Example</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>@LaunchDarkly /createFlag</code></td>
      <td>GitHub Copilot creates a LaunchDarkly feature flag based on your prompt</td>
      <td><code>@LaunchDarkly /createFlag I need a new feature flag for the account-migration project</code></td>
    </tr>

    <tr>
      <td><code>@LaunchDarkly /explain</code></td>
      <td>GitHub Copilot asks you to select a flag, and then provides a summary of the flag, its variations, and its [release pipeline](/docs/home/releases/release-pipelines) 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.</td>
      <td><code>@LaunchDarkly /explain</code></td>
    </tr>

    <tr>
      <td><code>@LaunchDarkly /cleanup</code></td>
      <td>GitHub 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 and restoring flags](/docs/home/flags/archive).</td>
      <td><code>@LaunchDarkly /cleanup</code></td>
    </tr>
  </tbody>
</table>

## 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](/docs/home/flags/list#save-shortcuts-to-filtered-flags-lists) 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](/docs/home/flags/code-references#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:

<CodeGroup>
  ```yaml title="Example Targeting YAML" lines wrap theme={null}
  targets:
    - name: Target Me in Context
      values: example-context-key
    - name: Target Me in Account Context
      contextKind: account
      values: account-1234
  rules:
    - name: My Test Organization
      clauses:
        - contextKind: user
          attribute: organization
          op: in
          negate: false
          values:
            - org-1234
  ```
</CodeGroup>

### 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](https://launchdarkly.com/policies/privacy/).

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](https://code.visualstudio.com/docs/configure/telemetry#_disable-telemetry-reporting).
