Skip to content

docs: Add VS Code extension documentation#16229

Open
rafaeelaudibert wants to merge 3 commits intomasterfrom
rafa/feat-add-vscode-extension-documentation
Open

docs: Add VS Code extension documentation#16229
rafaeelaudibert wants to merge 3 commits intomasterfrom
rafa/feat-add-vscode-extension-documentation

Conversation

@rafaeelaudibert
Copy link
Copy Markdown
Member

@rafaeelaudibert rafaeelaudibert commented Apr 8, 2026

Changes

Added comprehensive documentation for the PostHog VS Code extension, including:

  • Overview page with installation, authentication, and quick start guide
  • Inline code intelligence covering SDK detection, feature flag status indicators, event sparklines, autocomplete, and CodeLens actions
  • Sidebar dashboard documenting the flags, experiments, analytics, and X-ray tabs
  • Flag management explaining how to toggle, edit, create flags, and generate TypeScript types
  • Stale flag cleanup detailing AST-based scanning and automated refactoring for outdated flags
  • Session replay integration showing how to view session and user counts and jump to replays

We're gonna be marketing this real soon, so let's add some docs here! This covers most of the features we have, we can easily extend documentation in the future if needed. Backlinking to the extension docs hasn't been done yet; I'd appreciate help from the editorial team here somehow.

Checklist

  • I've read the docs and/or content style guides.
  • Words are spelled using American English
  • Use relative URLs for internal links
  • I've checked the pages added or changed in the Vercel preview build
  • If I moved a page, I added a redirect in vercel.json

We're gonna be marketing this real soon, so let's add some docs here! This covers most of the features we have, we can easily extend documentation in the future if needed. Backlinking to the extension hasn't been done yet, I'd appreciate help from the editorial team here somehow.
@rafaeelaudibert rafaeelaudibert requested review from a team, MattBro and fercgomes and removed request for a team April 8, 2026 00:18
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app
Copy link
Copy Markdown

graphite-app bot commented Apr 8, 2026

Merge activity

  • Apr 8, 12:36 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Apr 8, 12:36 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..
  • Apr 8, 9:59 PM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Apr 8, 9:59 PM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Deploy preview

Status Details Updated (UTC)
🔴 Failed View logs Apr 08, 2026 03:37PM

Push a fix or re-run the workflow to try again.

Common culprits
  • MDX issues - unescaped </> characters, unclosed tags, or malformed JSX
  • External API timeouts - GitHub, Strapi, or Ashby occasionally hiccup

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Vale prose linter → found 41 errors, 207 warnings, 8 suggestions in your markdown

Full report → · Copy the Job Summary code block into an LLM to batch-fix issues.

Note: Too many findings to show inline. See the Job Summary linked above.

File Errors Warnings Suggestions
contents/blog/best-feature-flag-software-for-developers.mdx 0 103 0
contents/docs/feature-flags/best-practices.mdx 0 14 3
contents/docs/feature-flags/cutting-costs.mdx 0 24 0
contents/docs/feature-flags/production-ready.mdx 2 2 4
contents/docs/getting-started/next-steps.mdx 1 21 0
contents/docs/libraries/js/index.mdx 0 7 1
contents/docs/model-context-protocol/index.mdx 0 1 0
contents/docs/model-context-protocol/vscode.mdx 0 2 0
contents/docs/vscode-extension/flag-management.mdx 7 1 0
contents/docs/vscode-extension/index.mdx 2 16 0
contents/docs/vscode-extension/inline-code-intelligence.mdx 16 4 0
contents/docs/vscode-extension/session-replay.mdx 4 3 0
contents/docs/vscode-extension/sidebar-dashboard.mdx 7 5 0
contents/docs/vscode-extension/stale-flag-cleanup.mdx 2 4 0

vercel.json Outdated
Comment on lines +1834 to +1836
{ "source": "/docs/vscode", "destination": "/docs/vscode-extension" },
{ "source": "/vscode-extension", "destination": "/docs/vscode-extension" },
{ "source": "/vscode", "destination": "/docs/vscode-extension" }
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.

we shouldn't add redirects if no pages existed before

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 was just thinking people might do /vscode as an attempt to find an extension and would automatically find it. Is that bad practice?

@@ -0,0 +1,80 @@
---
title: Flag management
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.

We should include these so it isn't confused with normal feature flags docs and people can search for it better.

Suggested change
title: Flag management
title: Flag management in the VS Code extension

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.

+1


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 without leaving your editor, clean up stale flags with AST-based refactoring, and jump to session replays for events in your codebase.
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.

Suggested change
With it, you can see live analytics data inline in your code, manage feature flags without leaving your editor, clean up stale flags with AST-based refactoring, and jump to session replays for events in your codebase.
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.

Comment on lines +152 to +157
## 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)
- [Session replay documentation](/docs/session-replay)
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.

Don't think we need this as we've already covered it multiple times.

Suggested change
## 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)
- [Session replay documentation](/docs/session-replay)

@@ -0,0 +1,114 @@
---
title: Inline code intelligence
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.

Suggested change
title: Inline code intelligence
title: Inline code intelligence and annotations

Comment on lines +21 to +23
- **`posthog.additionalClientNames`** — Add variable names like `["analytics", "ph"]` so the extension recognizes `analytics.capture()` the same way it recognizes `posthog.capture()`.
- **`posthog.detectNestedClients`** — When enabled (default), detects nested member expressions like `window.posthog?.capture()` or `this.analytics.posthog.capture()`.
- **`posthog.additionalFlagFunctions`** — Add bare function names like `["useMyFlag"]` that accept a flag key as the first argument. This is useful for custom hooks or wrapper functions.
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.

Suggested change
- **`posthog.additionalClientNames`** — Add variable names like `["analytics", "ph"]` so the extension recognizes `analytics.capture()` the same way it recognizes `posthog.capture()`.
- **`posthog.detectNestedClients`** — When enabled (default), detects nested member expressions like `window.posthog?.capture()` or `this.analytics.posthog.capture()`.
- **`posthog.additionalFlagFunctions`** — Add bare function names like `["useMyFlag"]` that accept a flag key as the first argument. This is useful for custom hooks or wrapper functions.
- `posthog.additionalClientNames` — Add variable names like `["analytics", "ph"]` so the extension recognizes `analytics.capture()` the same way it recognizes `posthog.capture()`.
- `posthog.detectNestedClients` — When enabled (default), detects nested member expressions like `window.posthog?.capture()` or `this.analytics.posthog.capture()`.
- `posthog.additionalFlagFunctions` — Add bare function names like `["useMyFlag"]` that accept a flag key as the first argument. This is useful for custom hooks or wrapper functions.

### Unrecognized flag keys

If you reference a flag key that doesn't exist in your PostHog project, the extension shows a **yellow underline warning**. You can use the quick-fix action to [create the flag directly from your editor](/docs/vscode-extension/flag-management#creating-flags-from-unrecognized-keys).
<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.

Suggested change
<ProductScreenshot
<ProductScreenshot

@@ -0,0 +1,44 @@
---
title: Session replay
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.

Suggested change
title: Session replay
title: Session replays in the VS Code extension

@@ -0,0 +1,76 @@
---
title: Sidebar dashboard
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.

Suggested change
title: Sidebar dashboard
title: Sidebar dashboard in the VS Code extension

Copy link
Copy Markdown
Contributor

@gewenyu99 gewenyu99 left a comment

Choose a reason for hiding this comment

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

This is so cool <3

url: '/docs/activity',
},
{
name: 'VS Code extension',
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.

Not an issue for this PR, but this is quite hidden. This is definitely the right place for now, but I'd love to find a better way to bring attention to this.

Maybe at the end of the installation sections we can mention this plugin, toolbar, the MCP server, etc. Maybe we can recommend in wizard?

Other than this, I'm thinking we rework the ProductOS nav a bit.

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.

Yeah, absolutely agree with it. I had a hard time navigating here myself, but it's the only reasonable place IMO, unfortunately.

I'll see if I can add some backlinks to improve this.


| Setting | Description | Default |
|---|---|---|
| `posthog.additionalClientNames` | Additional variable names the extension should recognize as PostHog clients (e.g., `["analytics", "ph"]`) | `[]` |
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.

Suggested change
| `posthog.additionalClientNames` | Additional variable names the extension should recognize as PostHog clients (e.g., `["analytics", "ph"]`) | `[]` |
| `posthog.additionalClientNames` | Additional variable names the extension should recognize as instances of PostHog clients (e.g., `["analytics", "ph"]`) | `[]` |

@@ -0,0 +1,80 @@
---
title: Flag management
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.

+1

title: Flag management
sidebar: Docs
showTitle: true
availability:
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.

I don't think these do anything anymore 🤔 The new website doesn't have these


## Installation

Install directly from your editor using these links:
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.

Use tabs for selections like this. Dw they render properly in the md version of the page


These settings can also be shared across your team via a [`.posthog.json` configuration file](/docs/vscode-extension#team-configuration).

## Feature flag status
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.

this is soooo coool


If you reference a flag key that doesn't exist in your PostHog project, the extension shows a **yellow underline warning**. You can use the quick-fix action to [create the flag directly from your editor](/docs/vscode-extension/flag-management#creating-flags-from-unrecognized-keys).
<ProductScreenshot
imageLight="https://res.cloudinary.com/dmukukwp6/image/upload/w_800,c_limit,q_auto,f_auto/pasted_image_2026_04_07_T17_59_45_503_Z_1d9df5f0a8.png"
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.

Can you update the w_800 to a higher value for these? Not sure how big your screenshots are. Code screenshots should be slightly higher definition imo. Clearer text :D


## Typo detection

The extension uses **Levenshtein distance matching** to detect likely typos in event names. If you type `capture("page_veiw")` but your project has an event called `page_view`, the extension flags it with a warning and suggests the correct name.
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.

thats so cool

Comment on lines +75 to +80
| Action | How to access |
|---|---|
| **Copy flag key** | Right-click context menu, CodeLens, or `PostHog: Copy Flag Key` command |
| **Open in PostHog** | CodeLens, sidebar, or `PostHog: Open in PostHog` command — opens the flag in your browser |
| **Find all references** | `PostHog: Find Flag References` — searches your workspace for every usage of a flag key |
| **View flag detail** | Click a flag in the sidebar or run `PostHog: Show Flag Detail` |
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.

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

enterprise: full
---

The VS Code extension connects your code to [session replay](/docs/session-replay) data, showing you how many sessions and users are triggering events and letting you jump directly to replays in PostHog.
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.

Suggested change
The VS Code extension connects your code to [session replay](/docs/session-replay) data, showing you how many sessions and users are triggering events and letting you jump directly to replays in PostHog.
The VS Code extension connects your code to [Session Replay](/docs/session-replay) data, showing you how many sessions and users are triggering events and letting you jump directly to replays in PostHog.z

in this case, it's the product (a proper noun) 🤓

…n docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rafaeelaudibert rafaeelaudibert force-pushed the rafa/feat-add-vscode-extension-documentation branch from 253c736 to bdbe63c Compare April 8, 2026 15:22
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants