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

add outputPath Config #123

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
jdneo merged 15 commits into LeetCode-OpenSource:master from ringcrl:master
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
feat: update outputPath api
  • Loading branch information
chengruilin committed Feb 14, 2019
commit 99cb09b731c3a14cfc595509b121a296f5db48b0
21 changes: 10 additions & 11 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,16 @@


## Settings
| Setting Name | Description | Default Value |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `leetcode.hideSolved` | Specify to hide the solved problems or not | `false` |
| `leetcode.showLocked` | Specify to show the locked problems or not. Only Premium users could open the locked problems | `false` |
| `leetcode.defaultLanguage` | Specify the default language used to solve the problem. Supported languages are: `bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `python`,`python3`,`ruby`,`scala`,`swift` | `N/A` |
| `leetcode.useWsl` | Specify whether to use WSL or not | `false` |
| `leetcode.endpoint` | Specify the active endpoint. Supported endpoints are: `leetcode`, `leetcode-cn` | `leetcode` |
| `leetcode.outputPath` | * `${tag}` - a directory based on the problem's tag. For example, if the problem belongs to: `Binary Indexed Tree`, then a folder named `binary_indexed_tree` will be used here. |
* `${language}` - a directory based on the language used. For example, `java` for Java language
* `${difficulty}` - a directory based on the problem's difficulty. For example, `easy`
* If this setting is not set, the files will be generated to the base path of the workspace folder | `root` |
| Setting Name | Description | Default Value |
|---|---|---|
| `leetcode.hideSolved` | Specify to hide the solved problems or not | `false` |
| `leetcode.showLocked` | Specify to show the locked problems or not. Only Premium users could open the locked problems | `false` |
| `leetcode.defaultLanguage` | Specify the default language used to solve the problem. Supported languages are: `bash`, `c`, `cpp`, `csharp`, `golang`, `java`, `javascript`, `kotlin`, `mysql`, `python`,`python3`,`ruby`,`scala`,`swift` | `N/A` |
| `leetcode.useWsl` | Specify whether to use WSL or not | `false` |
| `leetcode.endpoint` | Specify the active endpoint. Supported endpoints are: `leetcode`, `leetcode-cn` | `leetcode` |

## Troubleshooting
When you meet any problem, you can check the [Troubleshooting page](https://github.com/jdneo/vscode-leetcode/wiki/Troubleshooting) first.

## Release Notes

Expand Down
8 changes: 1 addition & 7 deletions package.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,8 @@
},
"leetcode.outputPath": {
"type": "string",
"default": "root",
"default": "",
"scope": "application",
"enum": [
"root",
"tag",
"language",
"difficulty"
],
"description": "Specifies the relative path to save the problem files."
}
}
Expand Down
24 changes: 17 additions & 7 deletions src/commands/show.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export async function searchProblem(): Promise<void> {

async function showProblemInternal(id: string): Promise<void> {
try {
const listProblems: IProblem[] = await list.listProblems();
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode");
let defaultLanguage: string | undefined = leetCodeConfig.get<string>("defaultLanguage");
if (defaultLanguage && languages.indexOf(defaultLanguage) < 0) {
Expand All @@ -50,21 +51,30 @@ async function showProblemInternal(id: string): Promise<void> {
}

let outDir: string = await selectWorkspaceFolder();
const outputPath: string = leetCodeConfig.get<string>("outputPath") || "root";
const outputPath: string = leetCodeConfig.get<string>("outputPath") || "";
const problem: IProblem | undefined = listProblems.find((item: IProblem) => item.id === id);
switch (outputPath) {
case "root": {
case "": {
break;
}
case "tag": {
const { tags } = await leetCodeExecutor.getCompaniesAndTags();
outDir = `${outDir}/${tags[id][0].split("-").map((c: string) => c[0].toUpperCase() + c.slice(1)).join("")}`;
case "${tag}": {
if (problem) {
outDir = `${outDir}/${problem.tags[0]}`;
}
break;
}
case "language": {
case "${language}": {
outDir = `${outDir}/${language}`;
break;
}
case "difficulty": {
case "${difficulty}": {
if (problem) {
outDir = `${outDir}/${problem.difficulty}`;
}
break;
}
default: {
outDir = `${outDir}/${outputPath}`;
break;
}
}
Expand Down

AltStyle によって変換されたページ (->オリジナル) /