🚀 Features
Better LeetCode brings the full LeetCode experience directly into your IDE with native support and no annoying boilerplate code.
- Web Authorization Login: Authenticate securely using LeetCode's official authorize-login flow directly via your browser with built-in CSRF protection.
- Direct SQL Support: First-class support for database problems with customized SQL configurations (MySQL, MS SQL, Oracle SQL, PostgreSQL).
- Problem Hints: Toggle and view hints line-by-line directly in the problem description view.
- Discussion Browsing: Browse problem discussions with paginated comments, threaded replies, and a dedicated discussion webview panel.
- Flexible Submission: Submit solutions against default test cases or hidden test cases effortlessly.
- Language Switch on the Fly: Change your target programming language seamlessly from the editor.
- Interactive Configurations: Easily change your default language or database language on the fly.
- Quick Shortcuts: Speed up your workflow with keyboard shortcuts (
Cmd+; / Ctrl+; to test, Cmd+Enter / Ctrl+Enter to submit).
- Intuitive UI Refreshing: Automatic refreshing on login/logout, and separate refresh triggers for Daily Challenge, Problems list, Study Lists, and Contests.
- No Boilerplate Comments: Write clean, standard code; the extension natively manages the underlying boilerplate.
- Native VS Code Tooling: Leverage VS Code's rich syntax highlighting, IntelliSense, auto-complete, and extensions.
- Integrated Debugger: Step through your code using VS Code's native debugger.
- Study Lists: Easily track and complete curated LeetCode study lists.
- Daily Problems: Quickly fetch and solve the daily LeetCode challenge with a single click.
Screenshot

🔑 Authentication / Login
To interact with LeetCode (fetch premium problems, submit solutions, track progress), you need to authenticate the extension. Better LeetCode supports two secure login methods:
1. Web Authorization (Recommended)
- Click the Sign In button in the sidebar or run the command
Better LeetCode: Sign In from the Command Palette (Cmd+Shift+P / Ctrl+Shift+P).
- Select Web Authorization (Recommended).
- Your browser will open the official LeetCode authorization page.
- Log in (if you aren't already) and authorize. The browser will securely redirect you back to VS Code, logging you in automatically.
2. LeetCode Cookie (Fallback)
If the web login flow does not work for your environment, you can manually paste your cookies:
- Go to LeetCode.com and log in.
- Open your browser's Developer Tools (usually
F12 or Cmd+Option+I).
- Navigate to the Application tab (Chrome/Edge) or Storage tab (Firefox).
- Under Cookies, select
https://leetcode.com.
- Find the cookie named
LEETCODE_SESSION and copy its value.
- Find the cookie named
csrftoken and copy its value.
- In VS Code, run
Better LeetCode: Sign In, select LeetCode Cookie, and paste the tokens when prompted to authenticate.
🛠️ Getting Started for Development
1. Prerequisites
- VS Code (version
^1.90.0 or higher)
- Node.js (version
^20.0.0 or higher)
- Bun (preferred package manager)
2. Install Dependencies
Initialize and install the required dependencies using Bun:
bun install
3. Compile and Run the Extension
To run and debug the extension locally:
- Open the project directory in VS Code.
- Press
F5 (or go to the Run and Debug view and select "Run Extension").
- A new window named [Extension Development Host] will launch.
- Open the Command Palette and type
Better LeetCode: Show Problem Statement or any other extension command to test it.
📦 Publishing the Extension
We use GitHub Actions to automate publishing the extension to the Visual Studio Marketplace.
Automated Publishing via GitHub Actions
- Ensure your extension version is updated in
package.json.
- Push your changes to the
main branch.
- Create a Release on GitHub with the new version tag (e.g.,
v1.3.0).
- The GitHub Actions workflow will automatically bundle and publish the extension.
Note: You must have the VSCE_PAT secret configured in your repository settings (Settings > Secrets and variables > Actions). This Personal Access Token should be generated from your Azure DevOps organization with "Marketplace" > "Manage" scopes.
Manual Publishing
If you need to publish manually from your local machine:
- Install
vsce globally:
npm install -g @vscode/vsce
- Package the extension:
bun run package
vsce package
- Publish the extension:
bun run publish
📄 Coding Guidelines
To maintain code quality and stability, please adhere to the rules defined in AGENTS.md:
- TypeScript Only: Write clean, type-safe TypeScript. Do not use the
any type under any circumstances.
- SOLID Principles: Keep components focused, modular, and decoupled.
- Comprehensive Testing: Write unit and integration tests for all core features and edge cases.
☕ Support
If you find this extension helpful and it saves you time, consider buying me a coffee to support its ongoing development!
