Skip to content

rkotze/lancedarkly

Repository files navigation

lancedarkly logo LanceDarkly

  1. Get started
  2. Commands
  3. Features
  4. Contributing
  5. Plugins API

Lancedarkly toggle view

Problem

Switching between VS Code, LaunchDarkly web app and other toggle integrations is inconvenient during development. Also, the LaunchDarkly app does not provide a view of toggle states (on|off) for all environments.

Solution

A VS Code extension to bring LaunchDarkly toggle management closer to your development environment and show all environment toggle states. Toggle on|off from VS Code.

Get started

  1. You will need a LaunchDarkly account.

  2. From LaunchDarkly you will need to generate an Access Token. You can find it under: Account Settings -> Access Tokens -> Your access tokens.

  3. Set the role to writer to update toggle state (Turn toggles on/off).

  4. Default Project key. It's all lowercase and highlighted in gray. You can find it under: Account Settings -> Projects -> Your projects

Update your setting in VS Code under LanceDarkly. See image below:

LanceDarkly Settings

Commands

  • ctrl+shift+p -> LanceDarkly: List all toggles Opens a new tab listing all toggles. Selecting a toggle shows you details about it.

Features

  • List all toggles in a project with a total count
  • Dashboard to count and group toggles by age
  • Search for toggles by name, key and description
  • Sort toggles by created date
  • Quick overview of toggle details:
    • Title, created date, description, key and kind
    • Maintainer information
    • Variations: value and name
    • Environments: show on or off state
    • Show what variant is set for the selected toggle state
    • Show a count of rules and prerequisites each environment
  • Update toggle state on/off per environment
  • Open toggle in LaunchDarkly
  • Copy key to clipboard
  • Settings for defaultProject and accessToken
  • Display data from third parties using the LanceDarkly Plugin API

Toggle ON/OFF

Confirm with optional message to toggle feature ON.

Popup confirm toggle ON

Dashboard

Dashboard summary of toggles in the project.

Dashboard of toggles

Filter/search toggles

Search toggles by name, key or description.

Filter toggles by name

Plugins

Extend the toggle details view with third party data.

Create a folder in your home directory called lancedarkly with a file called plugins.js: %user%/lancedarkly/plugins.js.

The plugin function is called when the LanceDarkly: List all toggles command is called.

Plugin API:

Only change the title and fields properties. Fields must be a 2D array.

The detailFields will pass through the toggle key.

Maximum of four fields and unlimited rows. First field has LanceDarkly label style applied.

Field widths: 20% 15% 15% 50%

// plugins.js

async function plugins() {
  const asyncData = await thirdPartyData(); // resolve data before turning API.
  return [
    {
      detailFields(key) {
        return {
          title: "Title",
          fields: [
            ["Production", "key", "guid", "random"],
            ["Integration", "key", "guid", "random"]
          ]
        };
      }
    }
  ];
}

exports.plugins = plugins;