Skip to content

Fix typos #110

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [0.9.0]
### Changed
- Improve the experience of switching endpoint ([#85](https://github.com/jdneo/vscode-leetcode/issues/85))
- Use webview to show the result page ([#76](https://github.com/jdneo/vscode-leetcode/issues/76))
- Use web view to show the result page ([#76](https://github.com/jdneo/vscode-leetcode/issues/76))


## [0.8.2]
Expand Down Expand Up @@ -54,7 +54,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [0.5.1]
### Fixed
- Fix the bug when user's path contains whitespaces ([#34](https://github.com/jdneo/vscode-leetcode/issues/34))
- Fix the bug when user's path contains white spaces ([#34](https://github.com/jdneo/vscode-leetcode/issues/34))

## [0.5.0]
### Added
Expand All @@ -66,7 +66,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

### Changed
- Simplify the command 'LeetCode: Test Current File' to 'LeetCode: Test' ([#18](https://github.com/jdneo/vscode-leetcode/issues/18))
- Will automatically save cuurent file when 'LeetCode: Test' command is triggered ([#17](https://github.com/jdneo/vscode-leetcode/issues/17))
- Will automatically save current file when 'LeetCode: Test' command is triggered ([#17](https://github.com/jdneo/vscode-leetcode/issues/17))

## [0.3.0]
### Added
Expand All @@ -75,7 +75,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [0.2.1]
### Fixed
- Fix the wrong icon bug in LeetCode Explorer ([#9](https://github.com/jdneo/vscode-leetcode/issues/9))
- Fix the switch session bug when login session is experied ([#12](https://github.com/jdneo/vscode-leetcode/issues/12))
- Fix the switch session bug when login session is expired ([#12](https://github.com/jdneo/vscode-leetcode/issues/12))

## [0.2.0]
### Added
Expand All @@ -86,7 +86,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [0.1.2]
### Fixed
- Fix the deplicated nodes in LeetCode Explorer bug ([#6](https://github.com/jdneo/vscode-leetcode/issues/6))
- Fix the duplicated nodes in LeetCode Explorer bug ([#6](https://github.com/jdneo/vscode-leetcode/issues/6))

## [0.1.1]
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
- 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**
- **Test with the written cases in file**

---

Expand Down
16 changes: 8 additions & 8 deletions docs/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

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

- 点击 `LeetCode Explorer` 中的 `Sign in to LeetCode` 即可登入。
Expand All @@ -49,7 +49,7 @@

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

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

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

- 在 `LeetCode Explorer` 中**右键**题目并选择 `Show Problem` 进行答题。
Expand All @@ -75,7 +75,7 @@

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

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

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

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

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

---

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

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

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

- 点击位于 VS Code 底部状态栏的 `LeetCode: ***` 管理 `LeetCode 存档`。你可以**切换**存档或者**创建**新的存档。
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"preview": true,
"activationEvents": [
"onCommand:leetcode.toogleLeetCodeCn",
"onCommand:leetcode.toggleLeetCodeCn",
"onCommand:leetcode.signin",
"onCommand:leetcode.signout",
"onCommand:leetcode.selectSessions",
Expand All @@ -47,7 +47,7 @@
"category": "LeetCode"
},
{
"command": "leetcode.toogleLeetCodeCn",
"command": "leetcode.toggleLeetCodeCn",
"title": "Switch Endpoint",
"category": "LeetCode",
"icon": {
Expand Down Expand Up @@ -133,7 +133,7 @@
"menus": {
"view/title": [
{
"command": "leetcode.toogleLeetCodeCn",
"command": "leetcode.toggleLeetCodeCn",
"when": "view == leetCodeExplorer",
"group": "navigation@0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/commands/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import { DialogType, promptForOpenOutputChannel, promptForSignIn } from "../util
import { deleteCache } from "./cache";

export async function switchEndpoint(): Promise<void> {
const isCnEnbaled: boolean = getLeetCodeEndpoint() === Endpoint.LeetCodeCN;
const isCnEnabled: boolean = getLeetCodeEndpoint() === Endpoint.LeetCodeCN;
const picks: Array<IQuickItemEx<string>> = [];
picks.push(
{
label: `${isCnEnbaled ? "" : "$(check) "}LeetCode`,
label: `${isCnEnabled ? "" : "$(check) "}LeetCode`,
description: "leetcode.com",
detail: `Enable LeetCode US`,
value: Endpoint.LeetCode,
},
{
label: `${isCnEnbaled ? "$(check) " : ""}力扣`,
label: `${isCnEnabled ? "$(check) " : ""}力扣`,
description: "leetcode-cn.com",
detail: `启用中国版 LeetCode`,
value: Endpoint.LeetCodeCN,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ async function showProblemInternal(id: string): Promise<void> {
return;
}

const outdir: string = await selectWorkspaceFolder();
await fse.ensureDir(outdir);
const result: string = await leetCodeExecutor.showProblem(id, language, outdir);
const outDir: string = await selectWorkspaceFolder();
await fse.ensureDir(outDir);
const result: string = await leetCodeExecutor.showProblem(id, language, outDir);
const reg: RegExp = /\* Source Code:\s*(.*)/;
const match: RegExpMatchArray | null = result.match(reg);
if (match && match.length >= 2) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { leetCodeExecutor } from "../leetCodeExecutor";
import { leetCodeManager } from "../leetCodeManager";
import { leetCodeResultProvider } from "../leetCodeResultProvider";
import { DialogType, promptForOpenOutputChannel, promptForSignIn } from "../utils/uiUtils";
import { getActivefilePath } from "../utils/workspaceUtils";
import { getActiveFilePath } from "../utils/workspaceUtils";

export async function submitSolution(uri?: vscode.Uri): Promise<void> {
if (!leetCodeManager.getUser()) {
promptForSignIn();
return;
}

const filePath: string | undefined = await getActivefilePath(uri);
const filePath: string | undefined = await getActiveFilePath(uri);
if (!filePath) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { leetCodeManager } from "../leetCodeManager";
import { leetCodeResultProvider } from "../leetCodeResultProvider";
import { IQuickItemEx, UserStatus } from "../shared";
import { DialogType, promptForOpenOutputChannel, showFileSelectDialog } from "../utils/uiUtils";
import { getActivefilePath } from "../utils/workspaceUtils";
import { getActiveFilePath } from "../utils/workspaceUtils";

export async function testSolution(uri?: vscode.Uri): Promise<void> {
try {
if (leetCodeManager.getStatus() === UserStatus.SignedOut) {
return;
}

const filePath: string | undefined = await getActivefilePath(uri);
const filePath: string | undefined = await getActiveFilePath(uri);
if (!filePath) {
return;
}
Expand All @@ -37,7 +37,7 @@ export async function testSolution(uri?: vscode.Uri): Promise<void> {
{
label: "$(file-text) Browse...",
description: "",
detail: "Test with the writen cases in file",
detail: "Test with the written cases in file",
value: ":file",
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
vscode.window.registerTreeDataProvider("leetCodeExplorer", leetCodeTreeDataProvider),
vscode.languages.registerCodeLensProvider({ scheme: "file" }, codeLensProvider),
vscode.commands.registerCommand("leetcode.deleteCache", () => cache.deleteCache()),
vscode.commands.registerCommand("leetcode.toogleLeetCodeCn", () => plugin.switchEndpoint()),
vscode.commands.registerCommand("leetcode.toggleLeetCodeCn", () => plugin.switchEndpoint()),
vscode.commands.registerCommand("leetcode.signin", () => leetCodeManager.signIn()),
vscode.commands.registerCommand("leetcode.signout", () => leetCodeManager.signOut()),
vscode.commands.registerCommand("leetcode.selectSessions", () => session.selectSession()),
Expand Down
10 changes: 5 additions & 5 deletions src/leetCodeExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class LeetCodeExecutor {
);
}

public async showProblem(id: string, language: string, outdir: string): Promise<string> {
return await this.executeCommandWithProgressEx("Fetching problem data...", "node", [await this.getLeetCodeBinaryPath(), "show", id, "-gx", "-l", language, "-o", `"${outdir}"`]);
public async showProblem(id: string, language: string, outDir: string): Promise<string> {
return await this.executeCommandWithProgressEx("Fetching problem data...", "node", [await this.getLeetCodeBinaryPath(), "show", id, "-gx", "-l", language, "-o", `"${outDir}"`]);
}

public async listSessions(): Promise<string> {
Expand Down Expand Up @@ -113,12 +113,12 @@ class LeetCodeExecutor {

public async getCompaniesAndTags(): Promise<{ companies: { [key: string]: string[] }, tags: { [key: string]: string[] } }> {
// preprocess the plugin source
const componiesTagsPath: string = path.join(await leetCodeExecutor.getLeetCodeRootPath(), "lib", "plugins", "company.js");
const componiesTagsSrc: string = (await fse.readFile(componiesTagsPath, "utf8")).replace(
const companiesTagsPath: string = path.join(await leetCodeExecutor.getLeetCodeRootPath(), "lib", "plugins", "company.js");
const companiesTagsSrc: string = (await fse.readFile(companiesTagsPath, "utf8")).replace(
"module.exports = plugin",
"module.exports = { COMPONIES, TAGS }",
);
const { COMPONIES, TAGS } = requireFromString(componiesTagsSrc, componiesTagsPath);
const { COMPONIES, TAGS } = requireFromString(companiesTagsSrc, companiesTagsPath);
return { companies: COMPONIES, tags: TAGS };
}

Expand Down
2 changes: 1 addition & 1 deletion src/leetCodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LeetCodeManager extends EventEmitter {
if (match && match[1]) {
resolve(match[1]);
} else {
reject(new Error("Failed to sigin in."));
reject(new Error("Failed to sign in."));
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function selectWorkspaceFolder(): Promise<string> {
return wsl.useWsl() ? wsl.toWslPath(workFolder) : workFolder;
}

export async function getActivefilePath(uri?: vscode.Uri): Promise<string | undefined> {
export async function getActiveFilePath(uri?: vscode.Uri): Promise<string | undefined> {
let textEditor: vscode.TextEditor | undefined;
if (uri) {
textEditor = await vscode.window.showTextDocument(uri, { preview: false });
Expand Down