📊 A powerful VS Code extension that displays file statistics and data insights directly in your status bar.
Shows file size, lines count, words count, array length, object size, and HTML/XML tag counts directly in your VS Code status bar—all updated in real-time as you work.
Display instantly in your VS Code status bar:
- File Size – Total size of the active file
- Selected Size – Size of selected text in bytes
- Lines Count – Number of selected lines
- Words Count – Number of selected words
- Character Count – Total and whitespace-excluded character counts
- Array Length – Automatic JSON array detection and element count
- Object Size – JSON object property count
- HTML/XML Tags – Element counts for markup
- Real-Time Updates – Metrics refresh instantly as you type or change selections
- Multi-Cursor Support – Handles multiple selections correctly
- JSON Parsing – Automatically detects and analyzes JSON structures
- Markup Detection – Recognizes HTML and XML content
- Custom Formatting – Use template variables and VS Code icons to design your display
- Regex Counting – Define custom patterns to count imports, exports, comments, and more
- Define custom display formats with variables and icons
- Choose status bar position (left/right) and priority
- Configure separators for metrics
Once installed, the extension works automatically:
- Open any file in VS Code
- Make a selection to see metrics
- Click the status bar item to view details in a popup
- Customize display format in settings
| Command | Purpose |
|---|---|
data-size-count.showCombinedDetails |
Display detailed statistics popup |
Access via Command Palette (Ctrl+Shift+P / Cmd+Shift+P) or click the status bar item.
All settings are optional with sensible defaults. Customize the extension to match your workflow.
| Setting | Default | Description |
|---|---|---|
data-size-count.statusBar.fileSizeFormat |
"$(file-text) ${fileSize}" |
Format for file size display |
data-size-count.statusBar.selectedSizeFormat |
"$(selection) ${selectedSize}" |
Format for selected text size |
data-size-count.statusBar.selectionCountFormat |
"${linesCount} : ${wordsCount} : ${charCount}" |
Format for selection metrics |
data-size-count.statusBar.dataCountFormat |
"$(database) ${dataCountWithBrackets} / ${maxDepth}" |
Format for data counts |
| Setting | Type | Default | Description |
|---|---|---|---|
data-size-count.statusBar.position |
string | "Left" |
Position ("Left" or "Right") |
data-size-count.statusBar.priority |
number | -1 |
Controls position order (higher = more to the left) |
data-size-count.statusBar.selectionMetricsSeparator |
string | `" | "` |
data-size-count.statusBar.regexCountSeparator |
string | ", " |
Separator between regex counts |
Use these variables in your custom format strings:
${fileSize}– File size with unit (e.g., "2.5 MB")
${selectedSize}– Size of selection in bytes${linesCount}– Number of selected lines${wordsCount}– Number of selected words${charCount}– Total characters in selection${charCountWithoutSpaces}– Characters excluding whitespace${emptyLineCount}– Number of empty lines in selection${duplicateLinesCount}– Count of duplicate lines${duplicateWordsCount}– Count of duplicate words
${dataType}– Type of data detected: "Array", "Object", "HTML", or "Other"${dataCount}– Count of elements/properties/tags${uniqueDataCount}– Count of unique items (arrays only)${maxDepth}– Maximum nesting depth${dataCountWithBrackets}– Count with brackets:[12],{8},<5>${uniqueDataCountWithBrackets}– Unique count with brackets${dataCountDesc}– Human-readable description${openBracket}/${closeBracket}– Bracket characters
${matchCount}– Number of regex pattern matches
Enhance your display using VS Code Codicons. Examples:
{
"data-size-count.statusBar.fileSizeFormat": "$(file-text) ${fileSize}",
"data-size-count.statusBar.selectionCountFormat": "$(pencil) ${linesCount}L : $(list) ${wordsCount}W",
"data-size-count.statusBar.dataCountFormat": "$(symbol-array) ${dataCountWithBrackets}"
}Add custom regex patterns to count specific elements (imports, exports, comments, etc.):
{
"data-size-count.statusBar.regexCount": [
{
"title": "Imports",
"format": "$(cloud-download) ${matchCount} Imports",
"regex": "^\\s*import\\b.*$"
},
{
"title": "Exports",
"format": "$(cloud-upload) ${matchCount} Exports",
"regex": "^\\s*export\\b.*$"
},
{
"title": "Comments",
"format": "$(comment) ${matchCount} Comments",
"regex": "^\\s*(//.*|#.*|<!--.*-->)$"
}
]
}Regex Entry Properties:
title– Human-readable name for this patternformat– Display format (use${matchCount}for the match count)regex– Regular expression pattern (supports JS RegExp syntax)onlyOnSelection– Evaluate only when text is selected (default: false)alwaysShow– Show entry even if match count is zero (default: false)
{
"data-size-count.statusBar.fileSizeFormat": "${fileSize}",
"data-size-count.statusBar.selectionCountFormat": "",
"data-size-count.statusBar.dataCountFormat": ""
}{
"data-size-count.statusBar.fileSizeFormat": "$(file-text) ${fileSize}",
"data-size-count.statusBar.selectionCountFormat": "$(pencil) ${linesCount}L | $(list) ${wordsCount}W | ${charCount}C",
"data-size-count.statusBar.dataCountFormat": "$(database) ${dataCountWithBrackets} / Depth: ${maxDepth}",
"data-size-count.statusBar.regexCount": [
{
"title": "Imports",
"format": "$(cloud-download) ${matchCount} Imports",
"regex": "^\\s*import\\b.*$"
}
]
}{
"data-size-count.statusBar.fileSizeFormat": "$(file-text) Size: ${fileSize}",
"data-size-count.statusBar.selectedSizeFormat": "Selected: ${selectedSize}",
"data-size-count.statusBar.selectionCountFormat": "$(pencil) ${linesCount}L | $(list) ${wordsCount}W | $(symbol-character) ${charCount}C",
"data-size-count.statusBar.dataCountFormat": "$(symbol-array) ${dataCountWithBrackets} | Depth: ${maxDepth}",
"data-size-count.statusBar.regexCount": [
{
"title": "TODOs",
"format": "$(checklist) TODOs: ${matchCount}",
"regex": "TODO"
}
]
}- File too large: Extension doesn't process files larger than 20 MB
- Extension disabled: Check Extensions → "Data Size Count" is enabled
- Status bar hidden: Use View → Toggle Status Bar
- Reload window: Ctrl+Shift+P → "Developer: Reload Window"
- Active editor required: Ensure a text editor is open
- Binary files: Only text files are supported
- Valid JSON required: Remove trailing commas, comments, and unquoted keys
- Complete selection: Select entire JSON structure
- Examples:
- ✅ Valid:
[1, 2, 3],{"name": "John"} - ❌ Invalid:
[1, 2,],{name: firstName}
- ✅ Valid:
Problem: Slow performance when working with very large files.
Solutions:
- File Size Optimization: The extension avoids processing files larger than 20 MB to prevent performance degradation.
- Selection Optimization: Making large selections (>100K characters) may cause slight delays.
- Other Extensions: Other extensions might also affect performance. Try disabling other extensions to isolate the issue.
Contributions are welcome! Here's how you can help:
- Report Issues: Found a bug? Open an issue with details about the problem.
- Request Features: Have a feature idea? Create a discussion to share your suggestion.
- Submit PRs: Want to contribute code? Fork the repo, make your changes, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Sivaraman (R35007)
- Email: sendmsg2siva@gmail.com
- GitHub: @R35007
- Repository: data-size-count-vscode-extension
If you find this extension helpful, consider supporting the developer:
See CHANGELOG.md for release notes and version history.
- Built with ❤️ using VS Code API
- Inspired by the need for quick file and selection metrics
- Thanks to all contributors and users who have provided feedback and support
Happy Coding! 🚀
Made with ❤️ by Sivaraman
