()
| 86 | } |
| 87 | |
| 88 | async function determineLeetCodeFolder(): Promise<string> { |
| 89 | let result: string; |
| 90 | const picks: Array<IQuickItemEx<string>> = []; |
| 91 | picks.push( |
| 92 | { |
| 93 | label: `Default location`, |
| 94 | detail: `${path.join(os.homedir(), ".leetcode")}`, |
| 95 | value: `${path.join(os.homedir(), ".leetcode")}`, |
| 96 | }, |
| 97 | { |
| 98 | label: "$(file-directory) Browse...", |
| 99 | value: ":browse", |
| 100 | }, |
| 101 | ); |
| 102 | const choice: IQuickItemEx<string> | undefined = await vscode.window.showQuickPick( |
| 103 | picks, |
| 104 | { placeHolder: "Select where you would like to save your LeetCode files" }, |
| 105 | ); |
| 106 | if (!choice) { |
| 107 | result = ""; |
| 108 | } else if (choice.value === ":browse") { |
| 109 | const directory: vscode.Uri[] | undefined = await showDirectorySelectDialog(); |
| 110 | if (!directory || directory.length < 1) { |
| 111 | result = ""; |
| 112 | } else { |
| 113 | result = directory[0].fsPath; |
| 114 | } |
| 115 | } else { |
| 116 | result = choice.value; |
| 117 | } |
| 118 | |
| 119 | getWorkspaceConfiguration().update("workspaceFolder", result, vscode.ConfigurationTarget.Global); |
| 120 | |
| 121 | return result; |
| 122 | } |
| 123 | |
| 124 | enum OpenOption { |
| 125 | justOpenFile = "Just open the problem file", |
no test coverage detected