Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ DevCycle is a feature flag platform that prioritizes speed, simplicity, and tigh

DevCycle supports boolean and multivariate flags, percentage rollouts, user targeting, and environment management. It integrates with GitHub and Jira for flag lifecycle management, and includes built-in stale flag detection to help teams clean up technical debt.

What sets DevCycle apart is its obsession with developer workflow. It supports CLI and IDE-first ways to work with flags, plus integrations with tools like GitHub and Jira so flags show up naturally in code review and planning. And their edge and local-bucketing style options help keep evaluation fast without you managing a full flag platform yourself.
What sets DevCycle apart is its obsession with developer workflow. It supports CLI and [IDE-first ways to work with flags](/docs/vscode-extension/flag-management), plus integrations with tools like GitHub and Jira so flags show up naturally in code review and planning. And their edge and local-bucketing style options help keep evaluation fast without you managing a full flag platform yourself.

DevCycle offers a free tier for up to 1,000 MAUs, with paid plans based on MAU volume.

Expand Down
2 changes: 1 addition & 1 deletion contents/docs/feature-flags/cutting-costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The number of `/flags` requests and the number of `$feature_flag_called` events

Active feature flags you're not using in your code are still evaluated (and charged) every time the `/flags` endpoint is called. This includes when surveys are loaded, as survey targeting evaluates all active flags to determine eligibility.

To stop charges for unused flags, you must **disable, delete, or archive** them in the PostHog UI – simply removing them from your code is not enough.
To stop charges for unused flags, you must **disable, delete, or archive** them in the PostHog UI – [simply removing them from your code](/docs/vscode-extension/stale-flag-cleanup) is not enough.

</CalloutBox>

Expand Down
2 changes: 1 addition & 1 deletion contents/docs/feature-flags/manage-flags-ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Manage Feature Flags with PostHog AI

## How it works

When you ask PostHog AI to create a flag, it creates it with your specified key and rollout percentage, configures targeting rules based on user properties, cohorts, or groups, and sets up variants and payloads for multivariate flags. It can also search your existing flags, identify stale flags not modified recently, and help you plan flag cleanup.
When you ask PostHog AI to create a flag, it creates it with your specified key and rollout percentage, configures targeting rules based on user properties, cohorts, or groups, and sets up variants and payloads for multivariate flags. It can also search your existing flags, identify stale flags not modified recently, and help you plan [flag cleanup](/docs/vscode-extension/stale-flag-cleanup).

## Manage existing flags

Expand Down
1 change: 1 addition & 0 deletions contents/docs/getting-started/next-steps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Read more about:
- [Installing feature flags](/docs/feature-flags/installation) and [creating your first flag](/docs/feature-flags/creating-feature-flags)
- [How we test in production](/product-engineers/testing-in-production) at PostHog using feature flags
- [Best practices for using feature flags](/docs/feature-flags/best-practices) in your product
- [VS Code extension](/docs/vscode-extension) — manage flags, see analytics, and clean up stale flags without leaving your editor

## 8. Try PostHog AI

Expand Down
2 changes: 1 addition & 1 deletion contents/docs/libraries/js/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import IdentifyFrontendCallout from '../../_snippets/identify-frontend-callout.m

<IdentifyFrontendCallout />

Once you've installed PostHog, see our [features doc](/docs/libraries/js/features) for more information about what you can do with it.
Once you've installed PostHog, see our [features doc](/docs/libraries/js/features) for more information about what you can do with it. You can also install the [PostHog VS Code extension](/docs/vscode-extension) to see live analytics, flag status, and session replay links inline in your code.

### Track across marketing website &amp; app

Expand Down
1 change: 1 addition & 0 deletions contents/docs/model-context-protocol/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ We're working on adding more supported tools to the wizard. If you're using anot
- [Replit integration](/docs/integrations/replit): Set up PostHog with Replit Agent
- [v0 integration](/docs/integrations/v0): Set up PostHog with v0 and the Vercel Flags SDK
- [PostHog MCP server](https://github.com/PostHog/posthog/tree/master/services/mcp): Check out GitHub repository for the MCP server
- [PostHog VS Code extension](/docs/vscode-extension): Inline analytics, flag management, and session replay links in your editor
- [Model Context Protocol](https://modelcontextprotocol.io/introduction): Learn more about the Model Context Protocol specification
- [MCP: machine/copy paste](/blog/machine-copy-paste-mcp-intro): What exactly is MCP again?
2 changes: 2 additions & 0 deletions contents/docs/model-context-protocol/vscode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import SharedContent from "./_snippets/shared.mdx"

The PostHog [MCP server](https://modelcontextprotocol.io/introduction) enables VS Code to directly interact with your PostHog data – managing feature flags, querying analytics, investigating errors, and more.

> **Note:** This is different from the [PostHog VS Code extension](/docs/vscode-extension), which provides inline analytics, flag management, and session replay links directly in your editor. They complement each other.

## Server URL

| Region | URL |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Configuration reference

| Setting | Description | Default |
|---|---|---|
| `posthog.additionalClientNames` | Additional variable names the extension should recognize as instances of PostHog clients (e.g., `["analytics", "ph"]`) | `[]` |
| `posthog.additionalFlagFunctions` | Additional bare function names that accept a flag key as the first argument (e.g., `["useMyFlag"]`) | `[]` |
| `posthog.detectNestedClients` | Detect PostHog clients accessed via nested member expressions like `window.posthog?.capture()` | `true` |
| `posthog.showInlineDecorations` | Show inline annotations (sparklines, flag status) in the editor | `true` |
| `posthog.inlineHintsMode` | When to show inline hints: `always` or `currentLine` | `always` |
| `posthog.staleFlagAgeDays` | Minimum number of days before a fully rolled out flag is considered stale | `30` |
| `posthog.staleFlagExcludePatterns` | Glob patterns for files and directories to exclude from stale flag scanning | `[]` |
| `posthog.useWorkspaceConfig` | Load configuration from a `.posthog.json` file in the workspace root | `true` |
| `posthog.multiProjectNotifications` | Show notifications when switching between projects in a multi-project workspace | `true` |
76 changes: 76 additions & 0 deletions contents/docs/vscode-extension/flag-management.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Flag management in the VS Code extension
sidebar: Docs
showTitle: true
---

The VS Code extension lets you create, toggle, edit, and manage [feature flags](/docs/feature-flags) without leaving your editor.

## Toggling flags

You can toggle a feature flag on or off from multiple places:

- **CodeLens** — Click the toggle action above a flag call in your code
- **Right-click context menu** — Right-click on a flag key string and select the toggle option
- **Sidebar Flags tab** — Click the toggle next to any flag in the list

A confirmation dialog appears before the change is applied to prevent accidental toggles. The change takes effect in PostHog immediately.

<ProductScreenshot
imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/w_1000,c_limit,q_auto,f_auto/pasted_image_2026_04_08_T00_01_21_431_Z_8c2c911a53.png"
alt="PostHog VS Code extension showing feature flag state"
classes="rounded"
/>

## Editing rollout and variants

From the flag detail panel (accessible via **PostHog: Show Flag Detail** or clicking a flag in the sidebar), you can edit:

- **Rollout percentage** — Adjust the percentage of users who see the flag
- **Variant configuration** — Modify variant names, weights, and distribution
- **Payloads** — Update the JSON payload associated with each variant

Changes are saved directly to PostHog.

## Creating flags from unrecognized keys

When the extension detects a flag key in your code that doesn't exist in your PostHog project, it shows a **yellow underline warning**. Hover over the warning to see a quick-fix action:

1. Click **Create Feature Flag** in the quick-fix menu
2. The extension creates the flag in PostHog using the key from your code
3. The warning disappears after the next sync

This lets you write code with new flags first and create them in PostHog without switching context.

<ProductScreenshot
imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/pasted_image_2026_04_08_T00_02_16_887_Z_9563f497ce.png"
alt="PostHog VS Code extension quick-fix to create a feature flag from an unrecognized key"
classes="rounded"
/>

## Generating TypeScript types

The extension can generate TypeScript types from your feature flag payload configurations, giving you type safety when working with flag values.

### All flags at once

Run **PostHog: Generate Flag Types** from the command palette to generate types for all flags in your project that have payload schemas defined.

### Individual flags

Right-click on a flag key in your code and select **PostHog: Generate Type** to generate a type for just that flag's payload.

The generated types reflect the structure of your flag payloads as configured in PostHog.

## Wrapping code in flag checks

Select a block of code, then use the context menu or command palette to **wrap it in a feature flag check**. The extension inserts the appropriate `isFeatureEnabled()` or `getFeatureFlag()` call around your selection, prompting you to choose which flag to use.

## Other flag actions

| Action | How to access | Command |
|---|---|---|
| **Copy flag key** | Right-click context menu or CodeLens | `PostHog: Copy Flag Key` |
| **Open in PostHog** | CodeLens or sidebar — opens the flag in your browser | `PostHog: Open in PostHog` |
| **Find all references** | Searches your workspace for every usage of a flag key | `PostHog: Find Flag References` |
| **View flag detail** | Click a flag in the sidebar | `PostHog: Show Flag Detail` |
174 changes: 174 additions & 0 deletions contents/docs/vscode-extension/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
title: VS Code extension
sidebar: Docs
showTitle: true
---

import ConfigurationReference from "./_snippets/configuration-reference.mdx"

The [PostHog VS Code extension](https://marketplace.visualstudio.com/items?itemName=PostHog.posthog-vscode) brings feature flags, experiments, event analytics, and session replay data directly into your editor. It works with JavaScript, TypeScript, Go and Ruby files (`.js`, `.jsx`, `.ts`, `.tsx`, `.go`, `.rb`).

With it, you can see live analytics data inline in your code, [manage feature flags](/docs/vscode-extension/flag-management) without leaving your editor, [clean up stale flags](/docs/vscode-extension/stale-flag-cleanup) with AST-based refactoring, and [jump to session replays](/docs/vscode-extension/session-replay) for events in your codebase.

> **Note:** This extension is different from the [PostHog MCP server for VS Code](/docs/model-context-protocol/vscode), which enables AI agents and Copilot to interact with PostHog. The VS Code extension provides direct, visual tooling for developers in the editor. They complement each other.

## Installation

Install directly from your editor:

<Tab.Group tabs={['VS Code', 'Cursor']}>
<Tab.List>
<Tab>VS Code</Tab>
<Tab>Cursor</Tab>
</Tab.List>
<Tab.Panels>
<Tab.Panel>

[Install in VS Code](vscode:extension/PostHog.posthog-vscode)

</Tab.Panel>
<Tab.Panel>

[Install in Cursor](cursor:extension/PostHog.posthog-vscode)

</Tab.Panel>
</Tab.Panels>
</Tab.Group>

Or install manually:

1. Open the Extensions panel (`Cmd+Shift+X` on Mac, `Ctrl+Shift+X` on Windows/Linux)
2. Search for **"PostHog"**
3. Click **Install**

The extension is also available on the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=PostHog.posthog-vscode) and the [Open VSX Registry](https://open-vsx.org/extension/PostHog/posthog-vscode).

<ProductScreenshot
imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/q_auto,f_auto/pasted_image_2026_04_07_T17_17_54_254_Z_0a1811dac8.png"
alt="PostHog VS Code extension in the marketplace"
classes="rounded"
/>

> **Requirements:**
> - VS Code 1.109.0 or later
> - A PostHog account

## Authentication

Once installed, authenticate the extension with your PostHog account:

1. Open the command palette (`Cmd+Shift+P` / `Ctrl+Shift+P`)
2. Run `PostHog: Sign In`
3. Click the sign-in button — this opens PostHog in your browser where you authenticate via OAuth
4. Once authenticated, run **PostHog: Select Project** to choose which project to connect to

After authenticating, the status bar at the bottom of VS Code shows your active project and last sync time.

<ProductScreenshot
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for bonus credits, can we frame this screenshot or take a wider screenshot with the background? The dimensions of this are such that it doesn't fit on my screen :P

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought ProductScreenshot would frame it. I'll see what I can do to get this to a good state

imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/w_500,c_limit,q_auto,f_auto/pasted_image_2026_04_07_T17_30_26_682_Z_279700c593.png"
alt="PostHog VS Code extension sign-in flow"
classes="rounded max-w-md"
/>

## Quick start

Once connected, the extension immediately starts analyzing your code:

- **SDK initialization diagnostics** help you verify that your PostHog `init()` calls are configured correctly, surfacing warnings if something looks off
- **Inline decorations** appear next to `posthog.capture()` calls showing 7-day event volume sparklines
- **Feature flag status** indicators show next to `posthog.isFeatureEnabled()` and `posthog.getFeatureFlag()` calls
- **CodeLens** actions appear above flag and capture calls with contextual links
- The **sidebar** populates with your feature flags, experiments, and saved insights

<ProductScreenshot
imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/w_1000,c_limit,q_auto,f_auto/pasted_image_2026_04_07_T17_48_06_446_Z_3ff1a0d2aa.png"
alt="PostHog VS Code extension quick start"
classes="rounded"
/>

For details on each feature, see:

| Feature | Description |
|---|---|
| [Inline code intelligence](/docs/vscode-extension/inline-code-intelligence) | Sparklines, flag status, autocomplete, and more |
| [Sidebar dashboard](/docs/vscode-extension/sidebar-dashboard) | Flags, experiments, analytics, and X-ray tabs |
| [Flag management](/docs/vscode-extension/flag-management) | Toggle, edit, create, and generate types for flags |
| [Stale flag cleanup](/docs/vscode-extension/stale-flag-cleanup) | Find and remove outdated flag checks |
| [Session replay](/docs/vscode-extension/session-replay) | See session and user counts, jump to replays |

## Team configuration

Share extension settings across your team by committing a `.posthog.json` file to your repository root:

```json
{
"projectId": 12345,
"additionalClientNames": ["analytics"],
"additionalFlagFunctions": ["useMyFlag"]
}
```

This ensures everyone on the team connects to the correct project and the extension recognizes your custom PostHog client variable names and flag wrapper functions.

### Multi-project workspaces

If your VS Code workspace contains multiple folders connected to different PostHog projects, the extension detects this automatically. Each folder can have its own `.posthog.json` with a different `projectId`. The extension switches context as you navigate between files in different folders.

Set `posthog.multiProjectNotifications` to `true` (default) to get notified when the active project changes.

### Automatic sync

The extension periodically refreshes its cache of feature flags, experiments, and event data from PostHog. The status bar shows when the last sync occurred. You can also manually refresh with the **PostHog: Refresh Feature Flags** command.

<ConfigurationReference />

## Commands reference

Open the command palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and type "PostHog" to see all available commands.

### Authentication and setup

| Command | Description |
|---|---|
| `PostHog: Sign In` | Authenticate with your PostHog personal API key |
| `PostHog: Sign Out` | Disconnect from PostHog |
| `PostHog: Select Project` | Choose which PostHog project to use |
| `PostHog: Run Setup Wizard` | Guided setup for first-time configuration |

### Feature flags

| Command | Description |
|---|---|
| `PostHog: Refresh Feature Flags` | Fetch the latest flags from PostHog |
| `PostHog: Create Feature Flag` | Create a new flag in PostHog |
| `PostHog: Copy Flag Key` | Copy a flag key to the clipboard |
| `PostHog: Show Flag Detail` | Open the detail panel for a flag |
| `PostHog: Open in PostHog` | Open the flag or experiment in your browser |
| `PostHog: Find Flag References` | Search the workspace for all usages of a flag key |
| `PostHog: Generate Flag Types` | Generate TypeScript types for all flag payloads |
| `PostHog: Generate Type` | Generate a TypeScript type for a single flag (context menu) |

### Experiments

| Command | Description |
|---|---|
| `PostHog: Show Experiment Detail` | Open the detail panel for an experiment |

### Session replay

| Command | Description |
|---|---|
| `PostHog: Watch Sessions` | View sessions for an event in your browser |

### Stale flags

| Command | Description |
|---|---|
| `PostHog: Scan for Stale Flags` | Scan the workspace for stale feature flag references |
| `PostHog: Clean Up Stale Flag` | Remove a stale flag check from the code |

## Further reading

- [PostHog VS Code extension on GitHub](https://github.com/PostHog/posthog-vscode)
- [PostHog MCP server for VS Code](/docs/model-context-protocol/vscode) — AI agent integration
- [Feature flags documentation](/docs/feature-flags)
Loading
Loading