Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>define-itNew to Visual Studio Code? Get it now.
define-it

define-it

Ch Rahul

|
1 install
| (0) | Free
Proactively detects undefined variables (ReferenceError) in JavaScript and TypeScript.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

define-it 🔍

Prevent runtime ReferenceError: keyword is not defined crashes before they hit production.

define-it is a fast, zero-configuration VS Code extension that scans your JavaScript and TypeScript files in real-time. It is designed especially for teams working with Git (pulling, merging, and cherry-picking), where missing declarations or conflicts often slip past local build tools and are only discovered during runtime sanity tests.


🚀 Key Features

  • ⚡ On-Save Static AST Scan: Scans your files in milliseconds upon save using a lightweight AST-based lexical scope analyzer.
  • 🌿 Proactive Git Diff Scanning: Automatically detects and scans files modified between your working branch and previous git actions (pulls, checkouts, merges, or cherry-picks) to flag newly introduced ReferenceErrors.
  • 🛠️ Workspace-Wide Global Resolution: Intelligently parses non-module script files across your workspace to gather global declarations, eliminating false positives for legacy script-based projects.
  • ⚙️ Custom Globals Ignore List: Define your own globals (like jQuery, $, or proprietary workspace variables) directly in VS Code settings.
  • 📁 Integrated Problems Panel: Diagnostics are output directly to VS Code's native Problems view, allowing you to double-click and jump straight to the offending undefined variable.

📸 How it Works

When you type and save code with an undeclared reference, define-it highlights it:

// console.js
console.log(myUndeclaredVar); // ⚠️ ReferenceError: 'myUndeclaredVar' is not defined.

The error is instantly pushed to the Problems view: Problems Panel Notification


⚙️ Configuration & Settings

You can customize define-it behavior by searching for define-it in VS Code Settings (Ctrl+,):

Setting Type Default Description
define-it.customGlobals string[] [] List of custom global variables to ignore during static analysis (e.g., ['jQuery', 'myCustomGlobal']).
define-it.ignorePaths string[] [] Additional directory/file paths to ignore during scanning (e.g., ['vendor', 'public/temp']). node_modules, dist, build, and .git are ignored by default.

⌨️ Commands

Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and run:

  • Define-It: Scan Git-Changed Files: Manually scans files that have changes between your current HEAD and HEAD@{1} or index (highly useful right after running a git pull or git cherry-pick).
  • Define-It: Scan Workspace: Performs a full scan of all supported JavaScript and TypeScript files in the active workspace.

📂 Supported Languages

  • JavaScript (.js, .jsx)
  • TypeScript (.ts, .tsx)

🛠️ Development & Contributing

If you'd like to run the extension locally or contribute:

  1. Clone the repository.
  2. Run npm install to install dependencies.
  3. Press F5 to launch the extension in the Extension Development Host.
  4. Run tests:
    npm run test
    

📄 License

MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft