diff --git a/.vscodeignore b/.vscodeignore index 93deb3ed..3a0fe8ce 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -11,3 +11,4 @@ tsconfig.json tslint.json **/*.gif ACKNOWLEDGEMENTS.md +docs diff --git a/README.md b/README.md index d58df769..4a7d644b 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,116 @@ # LeetCode -[![Travis CI](https://travis-ci.org/jdneo/vscode-leetcode.svg?branch=master)](https://travis-ci.org/jdneo/vscode-leetcode) -[![Marketplace Version](https://vsmarketplacebadge.apphb.com/version-short/shengchen.vscode-leetcode.svg)](https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-leetcode) -[![license](https://img.shields.io/github/license/jdneo/vscode-leetcode.svg)](https://github.com/jdneo/vscode-leetcode/blob/master/LICENSE) -[![Gitter](https://badges.gitter.im/vscode-leetcode/Lobby.svg)](https://gitter.im/vscode-leetcode/Lobby) -Solve LeetCode problems in VS Code. -- [中文](#中文) -- [English](#english) +> Solve LeetCode problems in VS Code + +

+ +

+

+ + + + + + + + + + + + +

+ +- [English Document](#Requirements) +- [中文文档](https://github.com/jdneo/vscode-leetcode/blob/master/docs/README_zh-CN.md) -# English ## Requirements - [Node.js 8+](https://nodejs.org) > NOTE: Please make sure that `Node` is in your `PATH` environment variable. You can check this by running: `node -v`. +## Quick Start + +![demo](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/gifs/demo.gif) + ## Features -- Sign in/out to LeetCode -- Switch and create session -- Show problems in explorer - > Note: To show the locked problems, please set `leetcode.showLocked` to **true** -- Search problems by keywords -- Test solutions by customized test case -- Submit solutions to LeetCode - -### Sign In and Sign Out -![SignInOut](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/signinout.gif) - -### Switch and Create Session -![SwitchSession](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/switchsession.gif) - -### Show Problems in Explorer 1 -![ShowProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/showproblem.gif) - -### Search Problems by Keywords 1 -![SearchProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/searchproblem.gif) - -### Test solutions by customized test case 2 -![TestSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/testsolution.gif) - -### Submit Solutions to LeetCode 2 -![SubmitSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/solveproblem.gif) - -1 If no folder is opened in VS Code, the extension will save the problem files in `$HOME/.leetcode/`.
-2 If you trigger the `Submit to LeetCode` and `Test in LeetCode` commands in the Command Palette, the extension will upload the current active file in editor. - -## Commands -This extension provides several commands in the Command Palette (F1 or Ctrl + Shift + P): -- **LeetCode: Sign in** - Sign in to LeetCode -- **LeetCode: Sign out** - Sign out to LeetCode -- **LeetCode: Select session** - Select one session and make it active -- **LeetCode: Create new session** - Create a new session -- **LeetCode: Refresh** - Refresh the LeetCode Explorer -- **LeetCode: Search Problem** - Search for problems by keywords -- **LeetCode: Test in LeetCode** - Test solution file by customized test case -- **LeetCode: Submit to LeetCode** - Submit the solution file to LeetCode -- **LeetCode: Switch endpoint** - Switch the LeetCode endpoint. (LeetCode or LeetCode-cn) + +### 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](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/btn_endpoint.png) 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. + +--- + +### Pick a Problem +

+ Pick a problem +

+ +- Right click the problem in the `LeetCode Explorer` and select `Show Problem` will generate a new file with the problem description for you. + + > Note: If no folder is opened in VS Code, the extension will save the problem files in **$HOME/.leetcode/**. + +--- + +### Submit the Answer +

+ Switch Endpoint +

+ +- You can submit the answer by clicking `🙏 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. + +--- + +### Test the Answer +

+ Switch Endpoint +

+ +- To **test** your answer, 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 writen cases in file** + +--- + +### Search problems by Keywords +

+ Switch Endpoint +

+ +- By clicking the button ![btn_search](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/btn_search.png) at the **explorer's navigation bar**, you can search the problems by keywords. + +--- + +### Manage Session +

+ Switch Endpoint +

+ +- 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. + ## Settings | Setting Name | Description | Default Value | @@ -64,9 +121,6 @@ This extension provides several commands in the Command Palette (F1 or Ctrl + Sh | `leetcode.useWsl` | Specify whether to use WSL or not | `false` | | `leetcode.endpoint` | Specify the active endpoint. Supported endpoints are: `leetcode`, `leetcode-cn` | `leetcode` | -## Known Issues: -- This extension will infer the current target problem according to the active editing file. Please do not change the file name. - ## Release Notes Refer to [CHANGELOG](https://github.com/jdneo/vscode-leetcode/blob/master/CHANGELOG.md) @@ -75,73 +129,3 @@ Refer to [CHANGELOG](https://github.com/jdneo/vscode-leetcode/blob/master/CHANGE - This extension is based on [@skygragon](https://github.com/skygragon)'s [leetcode-cli](https://github.com/skygragon/leetcode-cli) open source project. - Special thanks to our [contributors](https://github.com/jdneo/vscode-leetcode/blob/master/ACKNOWLEDGEMENTS.md). - - - -# 中文 -## 运行条件 -- [Node.js 8+](https://nodejs.org) - > 注意: 请确保`Node`在`PATH`环境变量中,您可以通过执行:`node -v`进行查看。 - -## 功能 -- 登入 / 登出 LeetCode -- 切换及创建 session -- 在 Explorer 中展示题目 - > 注意: 如果想要展示付费题目,您需要将 `leetcode.showLocked` 设置为 **true** -- 根据关键字搜索题目 -- 用自定义测试用例测试答案 -- 向 LeetCode 提交答案 - -### 登入及登出 -![SignInOut](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/signinout.gif) - -### 切换及创建 session -![SwitchSession](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/switchsession.gif) - -### 在 Explorer 中展示题目 1 -![ShowProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/showproblem.gif) - -### 根据关键字搜索题目 1 -![SearchProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/searchproblem.gif) - -### 用自定义测试用例测试答案 2 -![TestSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/testsolution.gif) - -### 向 LeetCode 提交答案 2 -![SubmitSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/solveproblem.gif) - -1 如果 VS Code 中没有已打开的文件夹,插件会将题目文件存储于 `$HOME/.leetcode/` 目录下。
-2 如果您通过命令面板触发 `Submit to LeetCode` 和 `Test in LeetCode` 命令,本插件将会提交当前文件至 LeetCode。 - -## 命令 -该插件在命令面板(F1 或 Ctrl + Shift + P)中支持下列命令: -- **LeetCode: Sign in** - 登入 LeetCode -- **LeetCode: Sign out** - 登出 LeetCode -- **LeetCode: Select session** - 激活一个已有的答题进度存档 -- **LeetCode: Create new session** - 创建一个新的答题进度存档 -- **LeetCode: Refresh** - 刷新左侧题目列表视图 -- **LeetCode: Search Problem** - 根据关键字搜索题目 -- **LeetCode: Test in LeetCode** - 用自定义测试用例进行测试 -- **LeetCode: Submit to LeetCode** - 提交答案到 LeetCode -- **LeetCode: Switch endpoint** - 变更 LeetCode 终端(LeetCode 或 领扣) - -## 插件配置项 -| 配置项名称 | 描述 | 默认值 | -|---|---|---| -| `leetcode.hideSolved` | 指定是否要隐藏已解决的问题 | `false` | -| `leetcode.showLocked` | 指定是否显示付费题目,只有付费账户才可以打开付费题目 | `false` | -| `leetcode.defaultLanguage` | 指定答题时使用的默认语言,可选语言有:`bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `python`,`python3`,`ruby`,`scala`,`swift` | `N/A` | -| `leetcode.useWsl` | 指定是否启用 WSL | `false` | -| `leetcode.endpoint` | 指定使用的终端,可用终端有:`leetcode`, `leetcode-cn` | `leetcode` | - -## 已知问题 -- 本插件会根据文件名称推测当前的目标题目,因此建议不要改变文件名。 - -## 更新日志 - -请参考[更新日志](https://github.com/jdneo/vscode-leetcode/blob/master/CHANGELOG.md) - -## 鸣谢 - -- 本插件基于[@skygragon](https://github.com/skygragon)的[leetcode-cli](https://github.com/skygragon/leetcode-cli)开源项目制作。 -- 特别鸣谢这些[贡献者们](https://github.com/jdneo/vscode-leetcode/blob/master/ACKNOWLEDGEMENTS.md)。 diff --git a/docs/README_zh-CN.md b/docs/README_zh-CN.md new file mode 100644 index 00000000..a739d371 --- /dev/null +++ b/docs/README_zh-CN.md @@ -0,0 +1,131 @@ +# LeetCode + +> 在 VS Code 中练习 LeetCode + +

+ +

+

+ + + + + + + + + + + + +

+ +- [English Document](#Requirements) +- [中文文档](https://github.com/jdneo/vscode-leetcode/blob/master/docs/README_zh-CN.md) + +## 运行条件 +- [Node.js 8+](https://nodejs.org) + > 注意:请确保`Node`在`PATH`环境变量中,您可以通过执行:`node -v`进行查看。 + +## 快速开始 + +![demo](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/gifs/demo.gif) + +## 功能 + +### 登入登出 +

+ Sign in +

+ +- 点击 `LeetCode Explorer` 中的 `Sign in to LeetCode` 即可登入。 + +- 你也可以使用下来命令登入或登出: + - **LeetCode: Sign in** + - **LeetCode: Sign out** + +--- + +### 切换 LeetCode 版本 +

+ Switch Endpoint +

+ +- LeetCode 目前有**英文版**和**中文版**两种版本。点击 `LeetCode Explorer` 导航栏中的 ![btn_endpoint](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/btn_endpoint.png) 按钮可切换版本。 + +- 目前可切换的版本有: + - **leetcode.com** + - **leetcode-cn.com** + + > 注意:两种版本的 LeetCode 账户并**不通用**,请确保当前激活的版本是正确的。插件默认激活的是**英文版**。 + +--- + +### 选择题目 +

+ Pick a problem +

+ +- 在 `LeetCode Explorer` 中**右键**题目并选择 `Show Problem` 进行答题。 + + > 注意:若当前 VS Code 没有已打开的文件夹,则生成的题目文件会存储于 **$HOME/.leetcode/** 目录下。 + +--- + +### 提交答案 +

+ Switch Endpoint +

+ +- 通过点击文件最下方的 `🙏 Submit to LeetCode` 可提交答案。 你也可以触发 **LeetCode: Submit to LeetCode** 命令将**当前**文件作为答案进行提交。 + +--- + +### 测试答案 +

+ Switch Endpoint +

+ +- 在编辑区内右键并选择 `Test in LeetCode`,可对**当前**答案进行测试。 + +- 有下列三种测试集来源: + - **默认测试集**:Test with the default cases + - **在输入框内输入测试集**:Write test cases in input box + - **提供自定义测试集文件**:Test with the writen cases in file + +--- + +### 通过关键字搜索题目 +

+ Switch Endpoint +

+ +- 点击 `LeetCode Explorer` 导航栏中的 ![btn_search](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/btn_search.png) 按钮可按照关键字搜索题目。 + +--- + +### 管理存档 +

+ Switch Endpoint +

+ +- 点击位于 VS Code 底部状态栏的 `LeetCode: ***` 管理 `LeetCode 存档`。你可以**切换**存档或者**创建**新的存档。 + + +## 插件配置项 +| 配置项名称 | 描述 | 默认值 | +|---|---|---| +| `leetcode.hideSolved` | 指定是否要隐藏已解决的问题 | `false` | +| `leetcode.showLocked` | 指定是否显示付费题目,只有付费账户才可以打开付费题目 | `false` | +| `leetcode.defaultLanguage` | 指定答题时使用的默认语言,可选语言有:`bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `python`,`python3`,`ruby`,`scala`,`swift` | `N/A` | +| `leetcode.useWsl` | 指定是否启用 WSL | `false` | +| `leetcode.endpoint` | 指定使用的终端,可用终端有:`leetcode`, `leetcode-cn` | `leetcode` | + +## 更新日志 + +请参考[更新日志](https://github.com/jdneo/vscode-leetcode/blob/master/CHANGELOG.md) + +## 鸣谢 + +- 本插件基于[@skygragon](https://github.com/skygragon)的[leetcode-cli](https://github.com/skygragon/leetcode-cli)开源项目制作。 +- 特别鸣谢这些[贡献者们](https://github.com/jdneo/vscode-leetcode/blob/master/ACKNOWLEDGEMENTS.md)。 diff --git a/docs/gifs/demo.gif b/docs/gifs/demo.gif new file mode 100644 index 00000000..07ebd612 Binary files /dev/null and b/docs/gifs/demo.gif differ diff --git a/docs/imgs/btn_endpoint.png b/docs/imgs/btn_endpoint.png new file mode 100644 index 00000000..d9ef1811 Binary files /dev/null and b/docs/imgs/btn_endpoint.png differ diff --git a/docs/imgs/btn_search.png b/docs/imgs/btn_search.png new file mode 100644 index 00000000..17f01fce Binary files /dev/null and b/docs/imgs/btn_search.png differ diff --git a/docs/imgs/endpoint.png b/docs/imgs/endpoint.png new file mode 100644 index 00000000..f78d10a3 Binary files /dev/null and b/docs/imgs/endpoint.png differ diff --git a/docs/imgs/pick_problem.png b/docs/imgs/pick_problem.png new file mode 100644 index 00000000..c5a27d8f Binary files /dev/null and b/docs/imgs/pick_problem.png differ diff --git a/docs/imgs/search.png b/docs/imgs/search.png new file mode 100644 index 00000000..bc50a1b4 Binary files /dev/null and b/docs/imgs/search.png differ diff --git a/docs/imgs/session.png b/docs/imgs/session.png new file mode 100644 index 00000000..a78eeddb Binary files /dev/null and b/docs/imgs/session.png differ diff --git a/docs/imgs/sign_in.png b/docs/imgs/sign_in.png new file mode 100644 index 00000000..89a5c057 Binary files /dev/null and b/docs/imgs/sign_in.png differ diff --git a/docs/imgs/submit.png b/docs/imgs/submit.png new file mode 100644 index 00000000..9c81a760 Binary files /dev/null and b/docs/imgs/submit.png differ diff --git a/docs/imgs/test.png b/docs/imgs/test.png new file mode 100644 index 00000000..b90feab8 Binary files /dev/null and b/docs/imgs/test.png differ diff --git a/resources/LeetCode.png b/resources/LeetCode.png index 727be2f8..76085991 100644 Binary files a/resources/LeetCode.png and b/resources/LeetCode.png differ diff --git a/resources/gif/searchproblem.gif b/resources/gif/searchproblem.gif deleted file mode 100644 index 79b0794b..00000000 Binary files a/resources/gif/searchproblem.gif and /dev/null differ diff --git a/resources/gif/showproblem.gif b/resources/gif/showproblem.gif deleted file mode 100644 index fd2970e9..00000000 Binary files a/resources/gif/showproblem.gif and /dev/null differ diff --git a/resources/gif/signinout.gif b/resources/gif/signinout.gif deleted file mode 100644 index 4965df8d..00000000 Binary files a/resources/gif/signinout.gif and /dev/null differ diff --git a/resources/gif/solveproblem.gif b/resources/gif/solveproblem.gif deleted file mode 100644 index d7a39184..00000000 Binary files a/resources/gif/solveproblem.gif and /dev/null differ diff --git a/resources/gif/switchsession.gif b/resources/gif/switchsession.gif deleted file mode 100644 index 0e2b3b6a..00000000 Binary files a/resources/gif/switchsession.gif and /dev/null differ diff --git a/resources/gif/testsolution.gif b/resources/gif/testsolution.gif deleted file mode 100644 index 91e9acd0..00000000 Binary files a/resources/gif/testsolution.gif and /dev/null differ