Code Arena: LeetCode practice in VS Code
Practice like it's the real interview: import Blind 75, start the timer
(autocomplete switches off), run your tests, and submit to LeetCode, all without
leaving the editor.
Install: search for Code Arena in the Extensions view (Ctrl+Shift+X), or run
code --install-extension avyaanstudios.code-arena. Free and open source (MIT).
Code Arena lives in the Activity Bar (stopwatch icon) and gives you:
- Import from LeetCode: one problem by URL or slug, or a whole list
(Blind 75, LeetCode 75, Top Interview 150, Top 100 Liked, any study plan,
or links you paste). The statement, example inputs, expected outputs,
difficulty, tags and LeetCode's starter code all come in.
- Run & submit on LeetCode: sign in once, then run your tests on LeetCode,
submit, and see the verdict with runtime/memory percentiles. An Accepted
submission marks the problem solved on your LeetCode account, and Sync
progress ticks off every imported problem you've already solved there.
- Switch language per problem from the panel (Python, JS, TS locally; Java,
C++, Go, Rust, C on LeetCode), starting from LeetCode's own snippet.
- Problems: paste a statement, choose a language, set the function to call,
and add test cases with expected outputs.
- Timed sessions: Start session starts the timer, opens your solution
file and turns autocomplete off. That covers suggestions, inline/AI ghost
text, parameter hints and snippets. Pause and resume are supported. Finish
restores your settings exactly as they were, even after a crash.
- Run tests (
Ctrl+Alt+Enter): every case shows pass/fail, input, expected,
actual, your print/console.log output, stderr, errors and time.
- Custom runs: call any function as the entry point with input you type.
- Rough work: a scratchpad for dry runs and notes, saved per problem.
- Analytics: run count (tests vs. custom), all-pass runs, time to first
all-pass, a log of every run, and past sessions with duration and solved/not solved.
- Every run's code is saved: in the run log and in past sessions, View
code opens the exact code a run used (read-only), and Diff compares it
with your current solution.
Importing from LeetCode
Click ⇣ LeetCode in the panel, or run Code Arena: Import from LeetCode….
- Each example becomes a test case. The expected output is read from the
statement's "Output:" lines.
- Your solution file starts from LeetCode's own snippet for the language
(e.g.
class Solution: def twoSum(...)), and the entry point is set for you.
If you switch the language, the entry point follows.
- LeetCode's built-in names are available just like on the site:
ListNode,
TreeNode, Node, List, Optional, deque, heapq…
- These run locally without any extra work:
- linked lists, trees, arrays of lists
- cycles (
pos) and LCA's p/q node lookups
- in-place problems (
void + modified argument)
- Clone Graph (it also checks you returned a real copy)
- design problems (
["Trie","insert",...])
- Serialize/Deserialize
- "Return the answer in any order" problems are compared ignoring order,
including inside nested lists.
- Lists are grouped in the problem picker with a solved count (✔ = solved in a
finished session here, or on LeetCode). Re-importing a list never duplicates problems.
Limits: premium problems can't be fetched (6 of the Blind 75 are premium, and
they are skipped and listed). A few problems with a LeetCode custom judge
(several valid answers) are flagged with a ⚠ in the panel. Imported problems run
locally in Python, JavaScript or TypeScript; in other languages they run on LeetCode.
Running and submitting on LeetCode
Click Sign in at the top of the panel and choose:
- Sign in with a browser window (recommended): a Chrome/Edge/Brave
window opens on LeetCode's login page. Log in any way you like (password,
Google, GitHub). Code Arena picks up the login and closes the window. The
window uses its own profile, so your normal browser profile is never
read, and only the leetcode.com login cookies are taken. Set
codeArena.leetcode.browserPath if your browser isn't found.
- Paste cookies manually: from leetcode.com → DevTools (
F12) →
Application → Cookies, copy LEETCODE_SESSION and csrftoken.
The login is stored in VS Code's SecretStorage (your OS keychain) and sent
only to leetcode.com. Sign out removes it, along with the sign-in window's profile.
Pick a language with the Language dropdown (before starting a session).
In a session:
- ☁ Run on LeetCode runs your test cases on LeetCode and compares them
with LeetCode's own expected answers. In Java, C++, Go, Rust and C,
Run tests goes to LeetCode automatically.
- ⇪ Submit runs the hidden tests. An Accepted verdict marks the
problem solved on LeetCode (the site does it, the same as submitting there)
and ✔ in the picker. Submissions and verdicts are counted in the session stats.
- When all local tests pass, Code Arena offers to submit. Set
codeArena.leetcode.submitWhenTestsPass to always, ask or never.
Sync progress fetches which imported problems you've solved on LeetCode.
If LeetCode's bot protection (Cloudflare) blocks requests from VS Code, or your
cookie expires, you'll be told. Then ↗ Copy & open copies your solution and
opens the problem in the browser so you can paste and submit there.
Languages
| Language |
Mode |
Needs |
| Python 3 |
call a function / method |
python (Windows) or python3 on PATH |
| JavaScript |
call a function / method |
Node.js |
| TypeScript |
call a function / method |
Node.js 22.7+ (built-in type stripping) |
| C++, C, Java, Go, Rust |
whole program, stdin → stdout |
g++/gcc, JDK 11+, go, rustc |
| Anything else |
whole program, stdin → stdout |
add it in codeArena.customLanguages |
Function mode input is one JSON value per line, and each line is one argument:
[2,7,11,15]
9
Expected output is the JSON return value, e.g. [0,1]. The entry point is
twoSum or Solution.twoSum. A Solution class is created for you, as on LeetCode.
Stdin mode: the input is piped to the program, and its stdout is compared
with the expected output (trailing whitespace ignored).
Adding a language (no code)
"codeArena.customLanguages": [
{
"id": "kotlin",
"displayName": "Kotlin",
"fileExtension": "kt",
"editorLanguageIds": ["kotlin"],
"buildCommand": "kotlinc \"${file}\" -include-runtime -d \"${dir}/main.jar\"",
"runCommand": "java -jar \"${dir}/main.jar\""
}
]
Commands
| Command |
|
| Code Arena: New Problem |
|
| Code Arena: Import from LeetCode… |
One problem, Blind 75, a study plan, or pasted links |
| Code Arena: Start Session / Pause / Resume / Finish Session |
|
| Code Arena: Run Tests |
Ctrl+Alt+Enter during a session |
| Code Arena: Open Solution File |
|
| Code Arena: Run Function in Current File… |
Run any function in any open JS/TS/Python file with typed arguments. This is not tracked. Also available in the editor context menu. |
| Code Arena: Sign in to LeetCode / Sign out |
Stores the session cookie in SecretStorage |
| Code Arena: Run Tests on LeetCode / Submit to LeetCode |
During a session |
| Code Arena: Sync Progress from LeetCode |
|
| Code Arena: Copy Code & Open on LeetCode |
Fallback when requests are blocked |
| Code Arena: Restore Autocomplete Settings |
Escape hatch if you ever need your settings back immediately. |
Settings
codeArena.defaultLanguage, codeArena.pythonPath, codeArena.nodePath,
codeArena.runTimeoutMs, codeArena.customLanguages,
codeArena.leetcode.submitWhenTestsPass (ask / always / never),
codeArena.leetcode.browserPath (browser for sign-in; empty = detect),
codeArena.focusMode.settingOverrides (the settings changed during a session;
add your own, such as another AI assistant's enable flag).
Development
npm install
npm test # compile + unit & integration tests (real interpreters)
Press F5 in VS Code to launch an Extension Development Host. See
DESIGN.md (in the source folder) for the architecture and the reasoning behind each pattern.
| |