diff --git a/CHANGELOG.md b/CHANGELOG.md index f0172d78..35e14f28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/README.md b/README.md index b94183fd..438ab39a 100644 --- a/README.md +++ b/README.md @@ -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** --- diff --git a/docs/README_zh-CN.md b/docs/README_zh-CN.md index 46716008..c91f8860 100644 --- a/docs/README_zh-CN.md +++ b/docs/README_zh-CN.md @@ -36,7 +36,7 @@ ### 登入登出

- Sign in + 登入登出

- 点击 `LeetCode Explorer` 中的 `Sign in to LeetCode` 即可登入。 @@ -49,7 +49,7 @@ ### 切换 LeetCode 版本

- Switch Endpoint + 切换 LeetCode 版本

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

- Pick a problem + 选择题目

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

- Switch Endpoint + 提交答案

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

- Switch Endpoint + 测试答案

- 在编辑区内右键并选择 `Test in LeetCode`,可对**当前**答案进行测试。 @@ -92,13 +92,13 @@ - 有下列三种测试集来源: - **默认测试集**: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 --- ### 通过关键字搜索题目

- Switch Endpoint + 通过关键字搜索题目

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

- Switch Endpoint + 管理存档

- 点击位于 VS Code 底部状态栏的 `LeetCode: ***` 管理 `LeetCode 存档`。你可以**切换**存档或者**创建**新的存档。 diff --git a/package.json b/package.json index 27a5323f..53aa74f2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "preview": true, "activationEvents": [ - "onCommand:leetcode.toogleLeetCodeCn", + "onCommand:leetcode.toggleLeetCodeCn", "onCommand:leetcode.signin", "onCommand:leetcode.signout", "onCommand:leetcode.selectSessions", @@ -47,7 +47,7 @@ "category": "LeetCode" }, { - "command": "leetcode.toogleLeetCodeCn", + "command": "leetcode.toggleLeetCodeCn", "title": "Switch Endpoint", "category": "LeetCode", "icon": { @@ -133,7 +133,7 @@ "menus": { "view/title": [ { - "command": "leetcode.toogleLeetCodeCn", + "command": "leetcode.toggleLeetCodeCn", "when": "view == leetCodeExplorer", "group": "navigation@0" }, diff --git a/src/commands/plugin.ts b/src/commands/plugin.ts index ed9286ca..3e3b5bf0 100644 --- a/src/commands/plugin.ts +++ b/src/commands/plugin.ts @@ -9,17 +9,17 @@ import { DialogType, promptForOpenOutputChannel, promptForSignIn } from "../util import { deleteCache } from "./cache"; export async function switchEndpoint(): Promise { - const isCnEnbaled: boolean = getLeetCodeEndpoint() === Endpoint.LeetCodeCN; + const isCnEnabled: boolean = getLeetCodeEndpoint() === Endpoint.LeetCodeCN; const picks: Array> = []; 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, diff --git a/src/commands/show.ts b/src/commands/show.ts index 7d17a9dc..780aa45e 100644 --- a/src/commands/show.ts +++ b/src/commands/show.ts @@ -49,9 +49,9 @@ async function showProblemInternal(id: string): Promise { 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) { diff --git a/src/commands/submit.ts b/src/commands/submit.ts index 663388f7..566b195b 100644 --- a/src/commands/submit.ts +++ b/src/commands/submit.ts @@ -6,7 +6,7 @@ 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 { if (!leetCodeManager.getUser()) { @@ -14,7 +14,7 @@ export async function submitSolution(uri?: vscode.Uri): Promise { return; } - const filePath: string | undefined = await getActivefilePath(uri); + const filePath: string | undefined = await getActiveFilePath(uri); if (!filePath) { return; } diff --git a/src/commands/test.ts b/src/commands/test.ts index e37c3c0e..548fa490 100644 --- a/src/commands/test.ts +++ b/src/commands/test.ts @@ -8,7 +8,7 @@ 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 { try { @@ -16,7 +16,7 @@ export async function testSolution(uri?: vscode.Uri): Promise { return; } - const filePath: string | undefined = await getActivefilePath(uri); + const filePath: string | undefined = await getActiveFilePath(uri); if (!filePath) { return; } @@ -37,7 +37,7 @@ export async function testSolution(uri?: vscode.Uri): Promise { { label: "$(file-text) Browse...", description: "", - detail: "Test with the writen cases in file", + detail: "Test with the written cases in file", value: ":file", }, ); diff --git a/src/extension.ts b/src/extension.ts index 52b66536..9685b3f4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -37,7 +37,7 @@ export async function activate(context: vscode.ExtensionContext): Promise 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()), diff --git a/src/leetCodeExecutor.ts b/src/leetCodeExecutor.ts index 71d5188a..1ee5ab4a 100644 --- a/src/leetCodeExecutor.ts +++ b/src/leetCodeExecutor.ts @@ -74,8 +74,8 @@ class LeetCodeExecutor { ); } - public async showProblem(id: string, language: string, outdir: string): Promise { - 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 { + return await this.executeCommandWithProgressEx("Fetching problem data...", "node", [await this.getLeetCodeBinaryPath(), "show", id, "-gx", "-l", language, "-o", `"${outDir}"`]); } public async listSessions(): Promise { @@ -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 }; } diff --git a/src/leetCodeManager.ts b/src/leetCodeManager.ts index c61bc476..0456d2d1 100644 --- a/src/leetCodeManager.ts +++ b/src/leetCodeManager.ts @@ -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.")); } }); }); diff --git a/src/utils/workspaceUtils.ts b/src/utils/workspaceUtils.ts index 3507c349..425074df 100644 --- a/src/utils/workspaceUtils.ts +++ b/src/utils/workspaceUtils.ts @@ -23,7 +23,7 @@ export async function selectWorkspaceFolder(): Promise { return wsl.useWsl() ? wsl.toWslPath(workFolder) : workFolder; } -export async function getActivefilePath(uri?: vscode.Uri): Promise { +export async function getActiveFilePath(uri?: vscode.Uri): Promise { let textEditor: vscode.TextEditor | undefined; if (uri) { textEditor = await vscode.window.showTextDocument(uri, { preview: false });