Solve LeetCode problems in VS Code
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 the LeetCode Explorer
will let you sign in with your LeetCode account.
You can also use the following command to sign in/out:
By clicking the button at the explorer's navigation bar, you can switch between different endpoints.
The supported endpoints are:
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 select Preview Problem
to see the problem description.
Select Show Problem
to directly open the file with the problem description.
Note: If no folder is opened in VS Code, the extension will save the problem files in $HOME/.leetcode/.
You can switch the default language by triggering the command:
LeetCode: Switch Default Language
.
Show Top Voted Solution
will display the top voted solution for you.
🙏 Submit to LeetCode
at the bottom of the file. Or you can trigger the command: LeetCode: Submit to LeetCode to submit the active file as the answer.
To test your answer, right click in the editor and select Test in LeetCode
.
There are 3 ways to test the answer:
LeetCode: ***
at the bottom of the status bar. You can switch between sessions or create a new session.Setting Name | Description | Default Value |
---|---|---|
leetcode.hideSolved |
Specify to hide the solved problems or not | false |
leetcode.showLocked |
Specify to show the locked problems or not. Only Premium users could open the locked problems | 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 |
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.outputFolder |
Specify the relative path to save the problem files. Besides using customized path, there are also several reserved words which can be used here:
|
N/A |
leetcode.enableStatusBar |
Specify whether the LeetCode status bar will be shown or not. | true |
leetcode.nodePath |
Specify the Node.js executable path. |
node |
When you meet any problem, you can check the Troubleshooting Page first.
Refer to CHANGELOG
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。