Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>LeetCode GateNew to Visual Studio Code? Get it now.
LeetCode Gate

LeetCode Gate

Shivam Verma

|
3 installs
| (0) | Free
Lock VS Code behind a daily LeetCode-style coding problem — solve it to unlock your editor.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

LeetCode Gate

Lock VS Code behind a daily coding challenge. Solve an Easy or Medium LeetCode-style problem every morning to unlock your editor for the day.


How it works

  1. VS Code opens → the extension activates automatically.
  2. If you haven't solved today's problem yet, a full-screen problem panel opens.
  3. Every text editor you try to open is immediately closed and you're redirected back to the problem.
  4. Write your JavaScript solution in the built-in editor, then click Run Tests.
  5. When all test cases pass, a success animation plays and VS Code unlocks for the rest of the day.
  6. At midnight the gate resets — a fresh problem awaits tomorrow.

Problem bank

14 hand-crafted problems across two difficulty tiers:

# Title Difficulty
1 Two Sum Easy
2 Valid Parentheses Easy
3 Palindrome Number Easy
4 Maximum Subarray Easy
5 Climbing Stairs Easy
6 Contains Duplicate Easy
7 Best Time to Buy and Sell Stock Easy
8 Longest Substring Without Repeating Characters Medium
9 Container With Most Water Medium
10 Product of Array Except Self Medium
11 Jump Game Medium
12 Group Anagrams Medium
13 Rotate Array Medium
14 Coin Change Medium

The daily problem is selected deterministically by day-of-year, so the same problem is shown all day even if VS Code restarts.


Commands

Command Description
LeetCode Gate: Show Today's Problem Re-opens the problem panel at any time
LeetCode Gate: Reset Today's Progress (Dev) Clears today's solved state — useful for testing

Building & running locally

cd leetcode-gate
npm install
npm run compile       # TypeScript → out/
npm test              # Run Vitest unit tests

Then press F5 in VS Code to launch the Extension Development Host.


Architecture

src/
├── extension.ts          Entry point — activation & blocking logic
├── GatekeeperState.ts    Persists solved state in VS Code's global storage
├── ProblemStore.ts       Problem bank with test cases and comparators
├── SolutionValidator.ts  Runs user code in an isolated vm sandbox
├── GatekeeperPanel.ts    Webview panel — problem UI and message bridge
├── SolutionValidator.spec.ts
├── ProblemStore.spec.ts
└── GatekeeperState.spec.ts

Blocking mechanism

onDidChangeActiveTextEditor fires whenever a text editor gains focus. While the gate is active, the listener immediately runs workbench.action.closeActiveEditor and re-reveals the problem webview. WebviewPanels are not text editors, so the panel itself is never affected.

Solution validation

User code is executed inside a vm.createContext() sandbox with:

  • A 3-second timeout to prevent infinite loops
  • Only safe ECMAScript globals (no require, process, or filesystem access)
  • console.log silently suppressed (but present so solutions don't crash)

License

MIT

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