Code Comment AssistantA production-ready VS Code extension that enforces documentation standards across JavaScript, TypeScript, React, Next.js, Node.js — and 36 languages in total, including PHP, Blade, Twig, HTML, Vue, Svelte, SQL, Python, Java, C/C++, C#, Go, Rust, CSS/SCSS, Ruby, YAML and more. It validates file headers and function documentation, surfaces issues in the Problems panel, and offers one-click quick fixes and commands to generate the missing documentation. Function detection uses the Babel AST for JavaScript/TypeScript/React and dedicated language scanners for PHP, Python, Java and Go — never blind regex. Descriptions can optionally be written by AI (Anthropic, OpenAI, OpenRouter or Google Gemini). Requirements
Quick start
Features1. File header validationEvery source file must begin with a documentation block:
Validated fields: File Name, Description, Developer, Created Date,
Last Modified. Any missing field raises a warning diagnostic. The required
fields and their order are configurable via 2. Function documentation validationEvery function must be preceded by a JSDoc block:
Required (validated): Description,
3. Auto-detected developer nameResolved in priority order:
Set it interactively with Code Comment: Set Developer Name. 4. DiagnosticsWarnings appear in the Problems panel, e.g. "Missing file documentation
header.", "Missing Developer field in file documentation header.",
"Function getUsers missing documentation.", "Function getUsers missing
@author.", "Function getUsers missing @created." A description made only of a
placeholder word (see 4a. Warning notification + navigable listWhen you open a file with documentation gaps, a warning toast appears in
the bottom-right — e.g. "Code Comment: 5 comments are missing in
UserController.php." — with three actions: Show List, Generate with
Comment (uses AI descriptions), and Generate without Comment (structure
only). Show List opens a clickable list of every undocumented
function/field; selecting one jumps straight to it. A status-bar item also shows
the current file's issue count. Run the list anytime with Code Comment: List
Missing Documentation. Toggle the toast with 5. Quick fixesA Generate Documentation quick fix (lightbulb / 6. CommandsOpen the Command Palette (
Generate/list commands are also available from the editor right-click menu (for supported languages). 7. Auto header for new filesCreating an empty 8. Auto "Last Modified" /
|
| Setting | Type | Default | Description |
|---|---|---|---|
codeDoc.developerName |
string | "" |
Name used in generated docs; overrides git config when set. |
codeDoc.enableAutoHeader |
boolean | true |
Insert headers into new files. |
codeDoc.enableValidation |
boolean | true |
Enable diagnostics. |
codeDoc.enableAutoModifiedDate |
boolean | true |
Update Last Modified on save. |
codeDoc.showWarningPopup |
boolean | true |
Show the bottom-right warning toast for the open file. |
codeDoc.supportedLanguages |
string[] | all 36 | Languages the extension is active for. |
codeDoc.headerFields |
string[] | File Name, Description, Developer, Created Date, Last Modified | Required file-header fields, in order. |
codeDoc.functionFields |
string[] | Description, @author, @created, @modified, @version, @param, @returns, @throws | Fields emitted in function docblocks, in order. |
codeDoc.inferTypes |
boolean | true |
Infer @param/@returns types from TypeScript code. |
codeDoc.headerTemplate |
string | "" |
Optional custom file-header template (placeholders like {{fileName}}). |
codeDoc.functionTemplate |
string | "" |
Optional custom function-docblock template. |
codeDoc.minDescriptionLength |
number | 0 |
Minimum meaningful description length (0 disables). |
codeDoc.placeholderBlocklist |
string[] | todo, tbd, fixme, description, xxx | Words treated as placeholder descriptions. |
codeDoc.enableWorkspaceScan |
boolean | true |
Enable the workspace coverage scan command. |
codeDoc.scanExclude |
string[] | node_modules, dist, out, build, .next, vendor, .git | Globs excluded from the workspace scan. |
codeDoc.useGitBlame |
boolean | false |
Attribute @author/@date to the git-blame author. |
codeDoc.ai.enabled |
boolean | false |
Use AI to auto-write Description fields (sends code to the configured provider). |
codeDoc.ai.provider |
string | anthropic |
AI provider: anthropic, openai, openrouter, or gemini. |
codeDoc.ai.model |
string | claude-opus-4-8 |
Anthropic (Claude) model for AI descriptions. |
codeDoc.ai.openaiModel |
string | gpt-4o-mini |
OpenAI model (when provider is openai). |
codeDoc.ai.openRouterModel |
string | meta-llama/llama-3.3-70b-instruct:free |
OpenRouter model slug (when provider is openrouter). |
codeDoc.ai.geminiModel |
string | gemini-2.0-flash |
Gemini model (when provider is gemini). |
codeDoc.ai.refreshOnChange |
string | inherit |
On save, update a changed function's description: off/ask/auto/inherit. Calls the provider. |
codeDoc.ai.refreshOnSave |
boolean | false |
(Legacy) Re-generate an AI-style docblock on save. Prefer refreshOnChange. |
A committed project-level
.codedocrc(or.codedocrc.json) file can override any of these settings per workspace.
Project structure
src/
├── extension.ts # entry point / composition root
├── commands/ # command handlers + registration
├── core/ # UI-free validation core
├── validators/ # file header & function doc validators
├── generators/ # header & function doc text generators
├── diagnostics/ # diagnostic collection manager
├── providers/ # CodeActionProvider (quick fixes)
├── parsers/ # Babel AST + PHP/Python/Java/Go scanners
├── dashboard/ # settings dashboard webview
├── services/ # config, developer, date, documentation, AI, lifecycle
├── utils/ # language, doc-block & editor helpers
└── types/ # shared interfaces & constants
Installation (from source)
npm install
npm run compile
Then press F5 in VS Code to launch an Extension Development Host with the extension loaded.
Build
npm run compile # one-off TypeScript build to ./out
npm run watch # incremental rebuilds
npm run lint # eslint
Package a .vsix
npm install -g @vscode/vsce # or use the local devDependency
npm run package # produces code-comment-assistant-1.0.0.vsix
Install the packaged extension:
code --install-extension code-comment-assistant-1.0.0.vsix
Publishing to the Marketplace
The publisher field in package.json is already set to whitelabel-iq.
- Ensure you have access to the
whitelabel-iqpublisher at https://marketplace.visualstudio.com/manage and an Azure DevOps Personal Access Token (scope: Marketplace → Manage). - Authenticate and publish:
vsce login whitelabel-iq
npm run publish # or: vsce publish [major|minor|patch]
Note: dependencies (
@babel/*,@anthropic-ai/sdk,openai) are intentionally independencies(notdevDependencies) sovscebundles them into the published package.
Known limitations
- File-scoped validation. Diagnostics run only on the file you have open; cross-file/whole-project checking is available only via the on-demand Scan Workspace Documentation Coverage command.
- Function-level docs are validated for JavaScript/TypeScript/React, PHP, Python, Java and Go. Other languages get file-header validation only.
- AI descriptions send code off-machine. When
codeDoc.ai.enabledis on, the relevant snippet is sent to your chosen provider. It is off by default. - The language scanners for PHP/Python/Java/Go are line-based (not full parsers); very unusual formatting may occasionally be missed.
Changelog
See CHANGELOG.md for release notes.
License
MIT — see the LICENSE file included with this extension.
Developed by Whitelabel IQ Team