Multi-level Outline Recognition: Automatically detects comment lines from **# to **###### as hierarchical headers, supporting up to 6 levels.
Shortcuts: Ctrl/Cmd + 1-6 to quickly convert to the corresponding header level; Ctrl/Cmd + 0 to revert to a standard code line.
Cursor Sync (Auto-Reveal): The outline view automatically highlights and navigates to the corresponding section as the cursor moves in the editor.
Setup: Click the “···” button in the top-right of the Outline view and check “Follow Cursor”. (Note: This is a VS Code GUI setting and cannot be configured via code).
Multi-level Numbering: Optional display of logical numbering (e.g., 1.1, 1.2.1) within the outline (must be enabled in settings).
Auto-Sync Numbering: When enabled, the extension automatically adds or removes numbering directly within the .do file based on the outline structure.
2. Code Execution (Stata Interaction)
Native Support (macOS): Communicates directly with Stata without requiring additional extensions. Note: Windows is currently not supported.
Flexible Execution Modes:
Global Execution: Click the ▶️ button in the editor title bar or Outline view header to run the current script.
Smart Section Run: When no code is selected, pressing Ctrl/Cmd + D automatically detects the current section and executes from that header down to (but not including) the next header of the same or higher level.
Precision Selection Run: Press Ctrl/Cmd + D to run the selected block. Supports fuzzy selection, executing complete lines even if not fully highlighted.
3. Efficient Separators & Styling
Quick Insertion: Supports various symbols to enhance code readability.
Standard Separators: Use Ctrl/Cmd + Symbol to insert a divider:
Ctrl + Alt + S (Windows) | Ctrl + Cmd + S (macOS), where S stands for “Separator”.
After the shortcut, simply input your desired character to generate the line.
Intelligent Wrap Mode:
Blank Line Insertion: Generates a full-width divider (length adjustable in settings).
Non-blank Line Insertion: Pressing the shortcut once inserts a divider above the line; pressing it again inserts one below, creating a “wrapped” header effect.
Header Decoration: Select header text and press the shortcut to generate a title with balanced decorative symbols (e.g., **# === Title ===). These decorations do not interfere with outline recognition.
4. Enhanced Commenting
Toggle Comments: Quickly toggle line comments using Ctrl/Cmd + /.
Optional Styles: Defaults to //, with support for switching to other valid Stata comment delimiters in settings.
Hierarchical outline view in Stata .do files (Left: VS Code, Right: Stata)
Installation
Extension Marketplace
Search for “Stata Outline” in VS Code extensions and install.
Open any .do file and navigate to Outline panel (Explorer → Outline) to view hierarchical structure.
Manual Installation
Download stata-outline-x.x.x.vsix from releases page.
In VS Code → Extensions panel → ... → Install from VSIX....
Select the downloaded file to complete installation.
Open any .do file and view Outline panel.
Configuration
Search for “Stata Outline” in VS Code settings and configure:
Stata Version (macOS) (stata-outline.stataVersion)
Select between StataMP, StataIC, StataSE when running on macOS.
Active Stata Window After Running Code (macOS) (stata-outline.activateStataWindow)
true (default): Brings Stata window to the foreground after code execution.
false: Does not change focus.
Comment Style (stata-outline.commentStyle)
// (default): Line comments with double slash.
* : Stata single-line comments.
/* ... */: Block-style comments.
Separator Length (stata-outline.separatorLength)
Numeric length used to size divider lines (including prefixes). Larger values produce longer separators.
Note: Changes take effect after reopening .do files. When updateFileContent is disabled, existing numbering in .do files will be automatically removed.
Usage Example
**# Data Processing
**## Cleaning
**### Remove duplicates
**# Model Estimation
***## Regression Analysis
With numbering (showNumbering: true):Outline shows 1. Data Processing, 1.1 Cleaning, 1.1.1 Remove duplicates, etc.
Without numbering (showNumbering: false):
Outline shows original headings Data Processing, Cleaning, etc.
Changelog
Version
Changes
Release Date
0.2.0-0.2.1
macOS native section/run support (no external dependency); play button also in Outline view; new divider line commands and shortcuts
2026-01-25
0.1.9
Outline now follows cursor, highlighting corresponding sections in real-time
2026-01-24
0.1.7-0.1.8
Added toggle comments functionality with customizable comment styles
2026-01-22
0.1.5-0.1.6
Added “Run Current Section” feature
2026-01-12
0.1.4
Added multi-level numbering display and auto-update file content