Solve LeetCode problems in VS Code
- English Document | 中文文档
Note: If you are using
leetcode-cn.com
, you can just ignore this section.
Recently we observed that the extension cannot login to leetcode.com endpoint anymore. The root cause of this issue is that leetcode.com changed its login mechanism and so far there is no ideal way to fix that issue.
Thanks for @yihong0618 provided a workaround which can somehow mitigate this. Now you can simply click the Sign In
button and then select Third Party
login or Cookie
login.
Note: If you want to use third-party login(Recommended), please make sure your account has been connected to the thrid-party. If you want to use
Cookie
login, click here to see the steps.
- 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
.