wangxiaolei5/vscode-leetcode

 
 

Repository files navigation

Solve LeetCode problems in VS Code

coding

  • VS Code 1.30.1+
  • Node.js 8+

    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.

demo

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

  • By clicking the button btn_endpointat 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.


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: 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

  • Select Show Top Voted Solution will display the top voted solution for you.

Submit the Answer

  • You can submit the answer by clicking Submit at the bottom of the file. Or you can right click in the editor and select Submit to LeetCode.

If you want to hide the shortcuts showing in the editor, just simply set the setting leetcode.enableShortcuts to false.


Test the Answer

  • You can test the answer by clicking Test at the bottom of the file. Or you can right click in the editor and select Test in LeetCode.

  • There are 3 ways to test the answer:

    • Test with the default cases
    • Write test cases in input box
    • Test with the written cases in file

Search problems by Keywords

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

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 a new session.
Setting NameDescriptionDefault Value
leetcode.hideSolvedSpecify to hide the solved problems or notfalse
leetcode.showLockedSpecify to show the locked problems or not. Only Premium users could open the locked problemsfalse
leetcode.defaultLanguageSpecify 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,swiftN/A
leetcode.useWslSpecify whether to use WSL or notfalse
leetcode.endpointSpecify the active endpoint. Supported endpoints are: leetcode, leetcode-cnleetcode
leetcode.outputFolderSpecify the relative path to save the problem files. Besides using customized path, there are also several reserved words which can be used here:
  • ${tag}: Categorize the problem according to their tags.
  • ${language}: Categorize the problem according to their language.
  • ${difficulty}: Categorize the problem according to their difficulty.
N/A
leetcode.enableStatusBarSpecify whether the LeetCode status bar will be shown or not.true
leetcode.enableShortcutsSpecify whether the submit and test shortcuts in editor or not.true
leetcode.enableSideModeSpecify whether preview, solution and submission tab should be grouped into the second editor column when solving a problem.true
leetcode.nodePathSpecify the Node.js executable path.node

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

About

Solve LeetCode problems in VS Code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%