Skip to content

VS Code Extension

The LocalFlag VS Code extension provides a sidebar view to see all your feature flags and toggle boolean flags with a single click.

Install from one of the marketplaces:

Or build locally:

Terminal window
cd apps/vscode-extension
pnpm install
pnpm build

Then press F5 in VS Code to launch the Extension Development Host.

The extension adds a LocalFlag icon to your activity bar. Click it to see all detected feature flags organized by file:

LocalFlag
├── src/flags.ts
│ ├── darkMode: false (boolean)
│ ├── newHeader: true (boolean)
│ └── maxItems: 10 (number)
└── config/flags.config.ts
└── ...

Boolean flags show a toggle icon on the right side. Click it to:

  1. Toggle the value (truefalse) directly in the source file
  2. Automatically save the file
  3. Update the sidebar to reflect the new value

Click any flag name to jump directly to its definition in the source file.

Get autocomplete suggestions for flag names when using LocalFlag hooks and components:

// Type the opening quote and see all available flags
useFeatureFlag<AppFlags>('|')
useFeatureFlagValue<AppFlags>('|')
<FeatureFlag<AppFlags> flag="|" />

The sidebar automatically updates when you:

  • Save a flag file
  • Create or delete flag files
  • Change extension settings

The extension recognizes these flag definition patterns:

export const defaultFlags = {
darkMode: false,
maxItems: 10,
} as const;
export const flags = defineFlags({
darkMode: false,
});
export const { flags, descriptions } = createFlags({
darkMode: { value: false, description: "Enable dark theme" },
});

Configure which files to scan for flags in your VS Code settings:

{
"localflag.flagFilePatterns": [
"**/flags.ts",
"**/flags.config.ts",
"**/*.flags.ts"
]
}
CommandDescription
LocalFlag: Refresh FlagsManually refresh the flag list
LocalFlag: Toggle FlagToggle a boolean flag (also available via inline icon)
LocalFlag: Go to Flag DefinitionJump to the flag’s source location

Use the refresh button in the sidebar title bar to manually refresh flags after external changes.