Skip to content

Commit

Permalink
feat: Can open the problem file directly (LeetCode-OpenSource#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Feb 14, 2020
1 parent 1c4a39e commit 1a129db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ export async function selectWorkspaceFolder(): Promise<string> {
if (needAsk) {
const choice: string | undefined = await vscode.window.showQuickPick(
[
OpenOption.justOpenFile,
OpenOption.openInCurrentWindow,
OpenOption.openInNewWindow,
OpenOption.addToWorkspace,
],
{ placeHolder: "Select how you would like to open your workspace folder" },
{ placeHolder: "The LeetCode workspace folder is not opened in VS Code, would you like to open it?" },
);

switch (choice) {
case OpenOption.justOpenFile:
return workspaceFolderSetting;
case OpenOption.openInCurrentWindow:
await vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(workspaceFolderSetting), false);
return "";
Expand Down Expand Up @@ -117,6 +120,7 @@ async function determineLeetCodeFolder(): Promise<string> {
}

enum OpenOption {
justOpenFile = "Just open the problem file",
openInCurrentWindow = "Open in current window",
openInNewWindow = "Open in new window",
addToWorkspace = "Add to workspace",
Expand Down

0 comments on commit 1a129db

Please sign in to comment.