Skip to content

Repository files navigation

Instant Count

VS Marketplace

Instantly count highlighted text, words, or fully-custom patterns – with live gutter badges, status-bar feedback, and one-click configuration.

Main Demo


✨ At a Glance

Feature What it does
Real-time Counter Status-bar number updates as you type or select
Numbered Badges Occurrence index drawn in the editor gutter
One-click Panel Click the counter to toggle case/word/regex, enter rules, etc.
Peek / Select-All View or multi-cursor-select every match in one command
Custom Rules $TEXT / $RAWTEXT placeholders turn any selection into a regex
Safe & Fast Chunked scanning, regex timeout guard, view-port badge rendering

🚀 Quick Start

  1. Install from the VS Code Marketplace: instant-count.
  2. Select text (or just place the cursor on a word).
  3. Watch the status-bar counter and gutter badges appear.
  4. Hit Ctrl + Shift + Alt + C (or click the status-bar counter) to open the quick-config panel.

🔍 Advanced Regex Recipes

Below are four ready-to-paste rule examples in the same format used inside the extension.

Example 1: Untranslated i18n Keys

  • Select: t(
  • Regex Rule: t\(\s*"(en\.)[^"]+"\s*\)
  • Result: Flags t("en.some.key") calls still hard-coded to English.

Example 2: Left-over console.* Calls

  • Select: console
  • Regex Rule: (^|\s)(console\.(log|debug|warn|error))\s*\(
  • Result: Catches any console.log, .debug, .warn, .error still lurking in code.

Example 3: Duplicate Words

  • Select: the (or any word)
  • Regex Rule: \b$TEXT\s+$TEXT\b
  • Result: Finds “the the”, “return return”, etc., regardless of the word you pick.

Example 4: JSX Components Missing a Prop

  • Select: MyButton
  • Regex Rule: <MyButton\b(?![^>]*\bonClick=)
  • Result: Highlights every <MyButton …> with no onClick= prop.

Custom Rule in Action

Before After
Before After

⚙️ Configuration Reference

Setting Default Description
instant-count.caseSensitive false Match case exactly
instant-count.wholeWord false Add \b…\b boundaries
instant-count.useRegex false Treat search pattern as regex
instant-count.showGutterBadges true Toggle numbered badges
instant-count.showInStatusBar true Toggle status-bar counter
instant-count.regexRules "" Custom rule with $TEXT / $RAWTEXT

Open Command Palette → “Instant Count: Settings” for the interactive panel.


⌨️ Useful Commands

Command Keybinding What it does
Open Config Panel Ctrl + Shift + Alt + C (or click the status-bar counter) Toggle case / whole-word / regex / badges in place
Enter Regex Rules Ctrl + Shift + Alt + R Define $TEXT rules (validated live)
Select All Matches Ctrl + Shift + Alt + S Multi-cursor select
Peek All Matches Ctrl + Shift + Alt + P (or Ctrl + Shift + 3) Open VS Code peek panel
Go to Next / Previous Match Ctrl + Shift + Alt + . / Ctrl + Shift + Alt + , Jump between matches, wrap-around
Toggle Case / Whole Word / Regex Command Palette Individual mode toggles

(macOS uses Cmd in place of Ctrl.)


🛡 Performance & Safety

  • Full features (regex rules, whole-word, badges) up to 10 MB / 100k lines.
  • Beyond that, large-file mode keeps literal counting and viewport badges alive up to 50 MB.
  • Regex execution has a 1 s watchdog — catastrophic back-tracking aborts with a visible warning instead of freezing.
  • Badges are only rendered inside (and near) the view-port for zero scroll-lag.

🤝 Contributing

  1. Fork the repo, npm install, press F5 to launch the Extension Host.
  2. Submit pull-requests against the dev branch.
  3. All contributions are released under the MIT license.

📜 License

MIT © 2025 Ali Do

🤝 Contributing

PRs are welcome!

  1. Fork the repo · 2. npm install · 3. Press F5 to launch the Extension Host · 4. Submit a pull-request to main.

🚀 Install

VS Marketplace


Made with ♥ and a lot of regex.

About

Instantly count highlighted text, words, and sequential regex patterns with live gutter badges and status bar feedback.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages