Skip to content

KindofCrazy/vscode-leetcode

Β 
Β 

Repository files navigation

LeetCode Enhanced

Solve LeetCode problems in VS Code with enhanced split view and problem list management

πŸš€ Enhanced Features

This is an enhanced version of the original vscode-leetcode extension with the following improvements:

✨ New Features

1. Split View Mode

  • Description on Left, Code on Right: When viewing a problem, the description automatically opens in the left column and the code editor in the right column
  • Consistent Layout: All related views (submit results, test results, description) open in the left column for better organization
  • Configurable: Can be enabled/disabled via leetcode.enableSplitView setting

2. Problem List Management

  • Custom Problem Lists: Create and manage your own problem lists
  • Official Lists Support: Support for both official LeetCode problem lists and custom lists
  • URL-Based Problem Lists: Create problem lists from any LeetCode study plan or problem list URL
  • Easy Management: Right-click on problems to add/remove from lists
  • Persistent Storage: Problem lists are saved locally and persist across VS Code sessions

πŸ”§ Enhanced Functionality

Improved User Experience

  • Better Layout: All webview panels (submit, test, description) now respect the split view setting
  • Consistent Behavior: Unified display behavior across all LeetCode-related views
  • Smart Positioning: Views automatically position themselves based on your split view preference

New Commands

  • LeetCode: Create Problem List - Create a new custom problem list (empty or from URL)
  • LeetCode: Manage Problem Lists - View and manage existing problem lists
  • LeetCode: Add to Problem List - Add current problem to a list
  • LeetCode: Remove from Problem List - Remove current problem from a list

New Settings

  • leetcode.enableSplitView - Enable/disable split view mode (default: true)

πŸ“‹ Comparison with Original Extension

Feature Original Enhanced
Split View ❌ No βœ… Yes - Description left, code right
Problem Lists ❌ No βœ… Yes - Custom and official lists
View Consistency ❌ Mixed βœ… Yes - All views respect split setting
List Management ❌ No βœ… Yes - Full CRUD operations
Layout Control ❌ Limited βœ… Yes - Configurable split behavior

🎯 Quick Start

Installation

Option 1: Install from VS Code Marketplace

  • Search for "LeetCode Enhanced" in the VS Code Extensions marketplace
  • Click Install
  • Published by: keyang

Option 2: Install from GitHub Releases

  1. Download the latest .vsix file from GitHub Releases
  2. Install via VS Code:
    code --install-extension vscode-leetcode-enhanced-[version].vsix

Option 3: Install from Source

git clone https://github.com/KindofCrazy/vscode-leetcode.git
cd vscode-leetcode
npm install
npm run compile
vsce package
code --install-extension *.vsix

Basic Usage

  1. Sign in to LeetCode using the LeetCode Explorer panel
  2. Browse problems - click any problem to open it with split view
  3. Create problem lists - right-click on problems to add them to lists
  4. Manage your lists - use the Problem List section in the explorer

πŸ”§ Configuration

Split View Settings

{
  "leetcode.enableSplitView": true  // Enable split view mode
}

Problem List Management

  • Create List: Use LeetCode: Create Problem List command
  • Add Problems: Right-click on any problem β†’ "Add to Problem List"
  • Manage Lists: Use LeetCode: Manage Problem Lists command
  • Create from URL: Use LeetCode: Create Problem List command (select "Import from URL" option)

Supported URL Types

  • πŸ“š Study Plans - Any LeetCode study plan URL (e.g., /studyplan/top-100-liked/)
  • πŸ“‹ Problem Lists - Any LeetCode problem list URL (e.g., /problem-list/5VgExJRB/)
  • 🌐 Both Domains - Support for both leetcode.cn and leetcode.com
  • 🎯 Auto-Naming - Intelligent naming based on URL patterns

Requirements

  • VS Code 1.57.0+
  • Node.js 10+

    NOTE: Please make sure that Node is in your PATH environment variable. You can also use the setting leetcode.nodePath to specify the location of your Node.js executable.

❗️ Login Recommendation ❗️

Recommended: Use Cookie login for the best experience with this enhanced extension.

Why Cookie Login is Recommended

  • Web Authorization may redirect to the original LeetCode extension
  • Cookie Login provides direct access to this enhanced version
  • More Reliable for the enhanced features (split view, problem lists)

How to Use Cookie Login

  1. Get your LeetCode Cookie (via Network β†’ GraphQL):

    • Open the LeetCode website (leetcode.com or leetcode.cn) and make sure you are logged in
    • Press F12 to open Developer Tools
    • Go to the Network tab, filter to Fetch/XHR, then refresh the page (F5)
    • Click any graphql request in the list
    • In the right panel, under Request Headers, find the Cookie header and copy its full value
  2. Login with Cookie:

    • Click Sign In in the LeetCode Explorer
    • Select LeetCode Cookie (marked as Recommended)
    • Paste the Cookie header value you copied in step 1
    • You're logged in!

Note: For leetcode.cn, follow the same steps on the Chinese site and use the copied Cookie header value. This method follows guidance similar to community tutorials CSDN blog reference.

Features

Sign In/Out

Sign in

  • Simply click Sign in to LeetCode in the LeetCode Explorer will let you sign in with your LeetCode account.

  • You can also use the following command to sign in/out:

    • LeetCode: Sign in
    • LeetCode: Sign out

Switch Endpoint

Switch Endpoint

  • By clicking the button btn_endpoint at the explorer's navigation bar, you can switch between different endpoints.

  • The supported endpoints are:

    • leetcode.com
    • leetcode.cn

    Note: The accounts of different endpoints are not shared. Please make sure you are using the right endpoint. The extension will use leetcode.com by default.


Pick a Problem

Pick a Problem

  • Directly click on the problem or right click the problem in the LeetCode Explorer and select Preview Problem to see the problem description.

  • Select Show Problem to directly open the file with the problem description.

    Note:You can specify the path of the workspace folder to store the problem files by updating the setting leetcode.workspaceFolder. The default value is:$HOME/.leetcode/.

    You can specify whether including the problem description in comments or not by updating the setting leetcode.showCommentDescription.

    You can switch the default language by triggering the command: LeetCode: Switch Default Language.


Editor Shortcuts

Editor Shortcuts

  • The extension supports 5 editor shortcuts (aka Code Lens):

    • Submit: Submit your answer to LeetCode.
    • Test: Test your answer with customized test cases.
    • Star/Unstar: Star or unstar the current problem.
    • Solution: Show the top voted solution for the current problem.
    • Description: Show the problem description page.

    Note: You can customize the shortcuts using the setting: leetcode.editor.shortcuts. By default, only Submit and Test shortcuts are enabled.


Search problems by Keywords

Search problems by Keywords

  • By clicking the button btn_search at the explorer's navigation bar, you can search the problems by keywords.

Manage Session

Manage Session

  • To manage your LeetCode sessions, just clicking the LeetCode: *** at the bottom of the status bar. You can switch between sessions or create, delete a session.

Settings

Setting Name Description Default Value
πŸ†• Enhanced Settings
leetcode.enableSplitView NEW: Enable split view mode - description on left, code editor on right true
Original Settings
leetcode.hideSolved Specify to hide the solved problems or not false
leetcode.defaultLanguage Specify the default language used to solve the problem. Supported languages are: bash, c, cpp, csharp, golang, java, javascript, kotlin, mysql, php, python,python3,ruby,rust, scala, swift, typescript N/A
leetcode.useWsl Specify whether to use WSL or not false
leetcode.endpoint Specify the active endpoint. Supported endpoints are: leetcode, leetcode-cn leetcode
leetcode.workspaceFolder Specify the path of the workspace folder to store the problem files. ""
leetcode.filePath Specify the relative path under the workspace and the file name to save the problem files. More details can be found here.
leetcode.enableStatusBar Specify whether the LeetCode status bar will be shown or not. true
leetcode.editor.shortcuts Specify the customized shortcuts in editors. Supported values are: submit, test, star, solution and description. ["submit, test"]
leetcode.enableSideMode Specify whether preview, solution and submission tab should be grouped into the second editor column when solving a problem. true
leetcode.nodePath Specify the Node.js executable path. for example, C:\Program Files\nodejs\node.exe node
leetcode.showCommentDescription Specify whether to include the problem description in the comments false
leetcode.useEndpointTranslation Use endpoint's translation (if available) true
leetcode.colorizeProblems Add difficulty badge and colorize problems files in explorer tree true
leetcode.problems.sortStrategy Specify sorting strategy for problems list None
leetcode.allowReportData Allow LeetCode to report anonymous usage data to improve the product. list true

πŸ“ File Structure

src/
β”œβ”€β”€ commands/
β”‚   β”œβ”€β”€ problemList.ts          # New: Problem list management commands
β”‚   └── show.ts                 # Enhanced: Split view support
β”œβ”€β”€ problemList/
β”‚   └── problemListManager.ts   # New: Problem list data management
β”œβ”€β”€ webview/
β”‚   β”œβ”€β”€ leetCodePreviewProvider.ts    # Enhanced: Split view support
β”‚   └── leetCodeSubmissionProvider.ts # Enhanced: Split view support
└── shared.ts                   # Enhanced: New interfaces and types

πŸ”„ Migration from Original Extension

  1. Backup your settings (optional)
  2. Uninstall the original extension
  3. Install this enhanced version
  4. Your existing problems and settings will be preserved

🀝 Contributing

This project is based on the original vscode-leetcode extension.

Original Features Preserved

  • All original LeetCode functionality
  • Sign in/out capabilities
  • Problem browsing and solving
  • Test and submit functionality
  • All original settings and configurations

New Contributions

  • Split view layout system
  • Problem list management
  • Enhanced user interface
  • Improved view consistency

Want Help?

When you meet any problem, you can check out the Troubleshooting and FAQ first.

If your problem still cannot be addressed, feel free to reach us in the Gitter Channel or file an issue.

Release Notes

Refer to CHANGELOG

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


Note: This is an enhanced fork of the original vscode-leetcode extension. All original functionality is preserved while adding new features for better user experience.

About

Solve LeetCode problems in VS Code - My Version

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.2%
  • PowerShell 0.8%