Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>InitJSNew to Visual Studio Code? Get it now.
InitJS

InitJS

Turgut Hakkı Özdemir

|
1 install
| (0) | Free
Loads js files matching configurable init.js glob patterns and executes them in the current workspace context.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

InitJS Logo

InitJS

Visual Studio Marketplace Version Visual Studio Marketplace Installs License: MIT VS Code ^1.85.0

Load `init.js` files as VS Code workspace context — automatically, on creation or change.

InitJS watches your workspace for files matching configurable glob patterns (default: /.vscode/*init.js) and loads them with require, following the same activate / deactivate lifecycle as VS Code extensions. Perfect for bootstrapping workspace-local tooling, keybindings helpers, or any setup code you want to keep inside your project's .vscode folder.


Features

  • 🚀 Automatic loading — existing matching files are loaded on activation.
  • 👁️ Live reload — when a matching file is created or changed, it is (re)loaded immediately. No window reload needed.
  • 🔄 Proper teardown — before re-requiring a changed file, the previous instance's deactivate() is called and its returned Disposable is disposed.
  • 🎛️ Configurable patterns — match init.js anywhere, only in .vscode, anchored to the root, or with custom * / ** globs.
  • 📁 Multi-root workspace support — patterns apply per workspace folder.

How it works

Each loaded file follows the familiar VS Code extension contract:

// .vscode/init.js
const vscode = require('vscode');

function activate() {
  const watcher = vscode.workspace.createFileSystemWatcher(
    new vscode.RelativePattern(vscode.workspace.workspaceFolders[0], '**/foo.txt')
  );
  watcher.onDidChange(() => console.log('foo.txt changed'));
  return watcher; // returned Disposable is disposed on reload
}

function deactivate() {
  // cleanup logic (optional)
}

module.exports = { activate, deactivate };

Configuration

Setting Type Default Description
initjs.patterns string[] ["/.vscode/*init.js"] Glob patterns of files to load when created or changed.

Pattern syntax

  • A pattern without a directory part (e.g. *.init.js) matches that file name in any directory.
  • A pattern with a directory part (e.g. .hede/hodo.js) matches that file name recursively inside any matching directory tree, at any depth.
  • A leading / anchors the pattern to the workspace root (e.g. /.vscode/*init.js matches only the root .vscode folder).
  • Supports * (single path segment) and ** (crosses path separators), plus ? (single character).

Examples

Setting value Matches
["/.vscode/*init.js"] (default) init.js, setup.init.js, … in the root .vscode folder only
[".vscode/*init.js"] the same, but in any .vscode folder at any depth
["**/*.init.js"] every *.init.js file in the workspace
[".vscode/*init.js", "scripts/init.js"] default plus one specific file
["tools/**/*.init.js"] every *.init.js under the tools tree
["/init.js"] only init.js in the workspace root itself

Requirements

  • VS Code ^1.85.0 or newer.

Release Notes

See CHANGELOG.md for the full release history.

License

MIT © 2026 Turgut Hakkı Özdemir

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