Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Focus FoldNew to Visual Studio Code? Get it now.
Focus Fold

Focus Fold

Yisays

|
3 installs
| (0) | Free
AI-powered code folding to focus on core logic
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Focus Fold

Version Installs License

AI-powered code folding for VS Code. Focus Fold uses LLMs to automatically identify your core business logic and fold away boilerplate — so you can read what actually matters.


Install

From the Marketplace (recommended):

  1. Open VS Code
  2. Press Ctrl+P / Cmd+P
  3. Paste: ext install YiSays.focus-fold

Or search "Focus Fold" in the Extensions panel.


How It Works

As projects grow, clean code gets buried under imports, error handling, logging, and validation. Focus Fold sends your code to an LLM that identifies which regions are core business logic and which are boilerplate — then folds the boilerplate away automatically.

project-root/
  .fold/
    src/
      main.py.json     ← fold data (gitignore this, or commit it)
  src/
    main.py            ← your source, now nicely focused

Features

Feature Description
🤖 AI Analysis LLM identifies core logic vs. boilerplate across your codebase
🏷️ Smart Labels Click-to-toggle labels above each foldable region
📊 Status Bar Live fold state indicator with region count
🔄 Auto-Fold on Open Files with fold data auto-collapse boilerplate when opened
💾 Auto-Reanalysis Re-analyzes on save to keep folding current
📁 Centralized Storage All fold data in .fold/ — no clutter in source directories
📝 FOCUS.md Auto-generated codebase overview with clickable navigation
🔌 Multiple LLM Providers z.ai (GLM-4.7), OpenAI (GPT-4), OpenRouter (Claude, Llama, etc.)

Setup

1. Configure Your LLM Provider

Open Settings (Cmd/Ctrl + ,) and search for "Focus Fold":

Setting Description
focusFold.llmProvider Choose: zai, openai, or openrouter
focusFold.zaiApiKey z.ai API key
focusFold.openaiApiKey OpenAI API key
focusFold.openrouterApiKey OpenRouter API key
focusFold.openrouterModel Model for OpenRouter (default: anthropic/claude-3.5-sonnet)

2. Get an API Key

z.ai (GLM-4.7) — recommended for cost efficiency:

  • Visit bigmodel.cn → sign up → copy your key
  • Endpoint: https://api.z.ai/api/paas/v4/ · Model: glm-4.7

OpenAI: platform.openai.com → API Keys

OpenRouter: openrouter.ai → Keys (pay-as-you-go, access to 100+ models)

3. Analyze Your Code

Open a Python file and run from the Command Palette (Cmd/Ctrl + Shift + P):

Focus Fold: Analyze Current File

Boilerplate regions will be folded immediately. Smart labels appear above each region.


Commands

Command Description
Focus Fold: Analyze Current File Analyze the open Python file
Focus Fold: Analyze Python Project Analyze all Python files in the workspace
Focus Fold: Re-analyze Current File Force re-analysis of the current file
Focus Fold: Test API Connection Verify your API key works
Focus Fold: Fold All Fold all regions in the current file
Focus Fold: Unfold All Unfold all regions
Focus Fold: Refold to Defaults Reset to default fold state
Focus Fold: Toggle Imports Toggle imports visibility
Focus Fold: Toggle Error Handling Toggle error handling visibility
Focus Fold: Toggle Logging Toggle logging visibility
Focus Fold: Toggle All Boilerplate Toggle all non-business-logic regions
Focus Fold: Generate FOCUS.md Generate project-wide codebase overview
Focus Fold: Open FOCUS.md Open the FOCUS.md file
Focus Fold: Migrate to .fold Folder Migrate old sidecar .fold.json files
Focus Fold: Show Folding Information Show fold info for the current file

Category Classification

Category Default Description
business-logic Visible Core algorithms and main logic
imports Folded Import statements
error-handling Folded Try-except blocks, error checking
logging Folded Log statements, debug output
helper-functions Folded Utility functions
data-loading Folded File I/O, data fetching
validation Folded Input validation
tests Folded Test code
configuration Folded Constants and settings

Status Bar & Smart Labels

Status bar shows current fold state:

  • ○ ? — Not analyzed (click to analyze)
  • › 7 — Folded (7 regions, click to unfold all)
  • ∨ 7 — Unfolded (click to fold all)

Smart labels appear above each foldable region. Configure the style:

Style Example
descriptive 📦 Import requests and pandas
compact 📦 13
minimal [13]

All Settings

Setting Default Description
focusFold.llmProvider zai LLM provider
focusFold.autoAnalyzeOnSave true Re-analyze on save (only if already analyzed)
focusFold.promptOnOpen true Prompt to analyze when opening unanalyzed files
focusFold.showSummaryInStatus true Show file summary in status bar
focusFold.autoUpdateFocus true Auto-update FOCUS.md when files are analyzed
focusFold.smartFoldLabels true Show smart labels on folded regions
focusFold.showFoldLabels true Show labels above folded regions (CodeLens)
focusFold.foldLabelStyle descriptive Label style: compact, descriptive, minimal
focusFold.showFoldCountInStatus true Show fold region counts in status bar
focusFold.autoFoldOnSave true Auto-apply folding when saving analyzed files
focusFold.enableContextCache true Cache project context for faster re-analysis
focusFold.contextCacheMaxAge 5 Cache max age in minutes
focusFold.contextCacheMaxEntries 10 Max cached project contexts
focusFold.useGlobalContext true Use global project context for better accuracy

FOCUS.md — Codebase Overview

FOCUS.md is an auto-generated markdown file providing a high-level overview of your analyzed codebase:

  • Project statistics (files, core regions, boilerplate regions)
  • Per-file summaries with descriptions
  • Clickable VS Code links to open files at specific line numbers
  • Grouped by directory

Generate via: Focus Fold: Generate FOCUS.md


Migration from v0.1.x

Version 0.2.0+ uses a centralized .fold/ folder. If you have old sidecar .fold.json files:

Focus Fold: Migrate to .fold Folder

Recommended .gitignore entry

.fold/
FOCUS.md

Roadmap

  • [ ] JavaScript / TypeScript support
  • [ ] Java and Go support
  • [ ] Manual region editing
  • [ ] Custom category preferences
  • [ ] Folding annotations in gutter

See BLUEPRINT.md for the full vision.


Contributing

See CONTRIBUTING.md for development setup, debug workflow, and contribution guidelines.

License

MIT © 2026 YiSays

Acknowledgments

  • Built with vscode-extension-samples
  • LLM providers: z.ai, OpenAI, OpenRouter
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft