Solve LeetCode problems in VS Code
- English Document | 中文文档
- VS Code 1.30.1+
- Node.js 8+
NOTE: Please make sure that
Node
is in yourPATH
environment variable. You can also use the settingleetcode.nodePath
to specify the location of yourNode.js
executable.
-
Simply click
Sign in to LeetCode
in theLeetCode 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
-
By clicking the button
at the explorer's navigation bar, you can switch between different endpoints.
-
The supported endpoints are:
- leetcode.com
- leetcode-cn.com
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.
-
Directly click on the problem or right click the problem in the
LeetCode Explorer
and selectPreview 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
.
-
The extension supports 4 editor shortcuts (aka Code Lens):
Submit
: Submit your answer to LeetCode.Test
: Test your answer with customized test cases.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, onlySubmit
andTest
shortcuts are enabled.
- 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.
leetcode.hideSolved
false
leetcode.showLocked
false
leetcode.defaultLanguage
bash
, c
, cpp
, csharp
, golang
, java
, javascript
, kotlin
, mysql
, php
, python
,python3
,ruby
,rust
, scala
,swift
N/A
leetcode.useWsl
false
leetcode.endpoint
leetcode
, leetcode-cn
leetcode
leetcode.workspaceFolder
""
leetcode.filePath
leetcode.filePath
instead leetcode.outputFolder
${tag}
: Categorize the problem according to their tags.${language}
: Categorize the problem according to their language.${difficulty}
: Categorize the problem according to their difficulty.
problem-${tag}-${difficulty}
leetcode.enableStatusBar
true
leetcode.editor.shortcuts
instead leetcode.enableShortcuts
true
leetcode.editor.shortcuts
submit
, test
, solution
and description
.["submit, test"]
leetcode.enableSideMode
preview
, solution
and submission
tab should be grouped into the second editor column when solving a problem.true
leetcode.nodePath
Node.js
executable path. for example, C:\Program Files\nodejs\node.exenode
leetcode.showCommentDescription
false
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.
Refer to CHANGELOG
- This extension is based on @skygragon's leetcode-cli open source project.
- Special thanks to our contributors.