Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

update the readme#98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdneo merged 13 commits intomasterfromcs/new-doc
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions.vscodeignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,3 +11,4 @@ tsconfig.json
tslint.json
**/*.gif
ACKNOWLEDGEMENTS.md
docs
226 changes: 105 additions & 121 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -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

<p align="center">
<img src="https://github.com/jdneo/vscode-leetcode/blob/master/resources/LeetCode.png" alt="">
</p>
<p align="center">
<a href="https://travis-ci.org/jdneo/vscode-leetcode">
<img src="https://img.shields.io/travis/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://gitter.im/vscode-leetcode/Lobby">
<img src="https://img.shields.io/gitter/room/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-leetcode">
<img src="https://img.shields.io/visual-studio-marketplace/d/shengchen.vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://github.com/jdneo/vscode-leetcode/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
</p>

- [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 <sup>1</sup>
![ShowProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/showproblem.gif)

### Search Problems by Keywords <sup>1</sup>
![SearchProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/searchproblem.gif)

### Test solutions by customized test case <sup>2</sup>
![TestSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/testsolution.gif)

### Submit Solutions to LeetCode <sup>2</sup>
![SubmitSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/solveproblem.gif)

<sup>1</sup> If no folder is opened in VS Code, the extension will save the problem files in `$HOME/.leetcode/`. <br/>
<sup>2</sup> 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/sign_in.png" alt="Sign in" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/endpoint.png" alt="Switch Endpoint" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/pick_problem.png" alt="Pick a problem" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/submit.png" alt="Switch Endpoint" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/test.png" alt="Switch Endpoint" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/search.png" alt="Switch Endpoint" />
</p>

- 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
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/session.png" alt="Switch Endpoint" />
</p>

- 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 |
Expand All@@ -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)
Expand All@@ -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 中展示题目 <sup>1</sup>
![ShowProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/showproblem.gif)

### 根据关键字搜索题目 <sup>1</sup>
![SearchProblem](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/searchproblem.gif)

### 用自定义测试用例测试答案 <sup>2</sup>
![TestSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/testsolution.gif)

### 向 LeetCode 提交答案 <sup>2</sup>
![SubmitSolution](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/resources/gif/solveproblem.gif)

<sup>1</sup> 如果 VS Code 中没有已打开的文件夹,插件会将题目文件存储于 `$HOME/.leetcode/` 目录下。<br/>
<sup>2</sup> 如果您通过命令面板触发 `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)。
131 changes: 131 additions & 0 deletionsdocs/README_zh-CN.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
# LeetCode

> 在 VS Code 中练习 LeetCode

<p align="center">
<img src="https://github.com/jdneo/vscode-leetcode/blob/master/resources/LeetCode.png" alt="">
</p>
<p align="center">
<a href="https://travis-ci.org/jdneo/vscode-leetcode">
<img src="https://img.shields.io/travis/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://gitter.im/vscode-leetcode/Lobby">
<img src="https://img.shields.io/gitter/room/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-leetcode">
<img src="https://img.shields.io/visual-studio-marketplace/d/shengchen.vscode-leetcode.svg?style=flat-square" alt="">
</a>
<a href="https://github.com/jdneo/vscode-leetcode/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jdneo/vscode-leetcode.svg?style=flat-square" alt="">
</a>
</p>

- [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)

## 功能

### 登入登出
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/sign_in.png" alt="Sign in" />
</p>

- 点击 `LeetCode Explorer` 中的 `Sign in to LeetCode` 即可登入。

- 你也可以使用下来命令登入或登出:
- **LeetCode: Sign in**
- **LeetCode: Sign out**

---

### 切换 LeetCode 版本
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/endpoint.png" alt="Switch Endpoint" />
</p>

- LeetCode 目前有**英文版**和**中文版**两种版本。点击 `LeetCode Explorer` 导航栏中的 ![btn_endpoint](https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/btn_endpoint.png) 按钮可切换版本。

- 目前可切换的版本有:
- **leetcode.com**
- **leetcode-cn.com**

> 注意:两种版本的 LeetCode 账户并**不通用**,请确保当前激活的版本是正确的。插件默认激活的是**英文版**。

---

### 选择题目
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/pick_problem.png" alt="Pick a problem" />
</p>

- 在 `LeetCode Explorer` 中**右键**题目并选择 `Show Problem` 进行答题。

> 注意:若当前 VS Code 没有已打开的文件夹,则生成的题目文件会存储于 **$HOME/.leetcode/** 目录下。

---

### 提交答案
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/submit.png" alt="Switch Endpoint" />
</p>

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

---

### 测试答案
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/test.png" alt="Switch Endpoint" />
</p>

- 在编辑区内右键并选择 `Test in LeetCode`,可对**当前**答案进行测试。

- 有下列三种测试集来源:
- **默认测试集**:Test with the default cases
- **在输入框内输入测试集**:Write test cases in input box
- **提供自定义测试集文件**:Test with the writen cases in file

---

### 通过关键字搜索题目
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/search.png" alt="Switch Endpoint" />
</p>

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

---

### 管理存档
<p align="center">
<img src="https://raw.githubusercontent.com/jdneo/vscode-leetcode/master/docs/imgs/session.png" alt="Switch Endpoint" />
</p>

- 点击位于 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)。
Binary file addeddocs/gifs/demo.gif
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/btn_endpoint.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/btn_search.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/endpoint.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/pick_problem.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/search.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/session.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/sign_in.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/submit.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addeddocs/imgs/test.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modifiedresources/LeetCode.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removedresources/gif/searchproblem.gif
View file
Open in desktop
Binary file not shown.
Binary file removedresources/gif/showproblem.gif
View file
Open in desktop
Binary file not shown.
Binary file removedresources/gif/signinout.gif
View file
Open in desktop
Binary file not shown.
Binary file removedresources/gif/solveproblem.gif
View file
Open in desktop
Binary file not shown.
Binary file removedresources/gif/switchsession.gif
View file
Open in desktop
Binary file not shown.
Binary file removedresources/gif/testsolution.gif
View file
Open in desktop
Binary file not shown.

[8]ページ先頭

©2009-2025 Movatter.jp