Skip to content
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
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@
},
"dependencies": {
"fs-extra": "^6.0.1",
"leetcode-cli": "2.6.1",
"opn": "^5.2.0"
"leetcode-cli": "2.6.1"
}
}
5 changes: 2 additions & 3 deletions src/leetCodeExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// Licensed under the MIT license.

import * as cp from "child_process";
import * as opn from "opn";
import * as path from "path";
import * as vscode from "vscode";
import { executeCommand, executeCommandWithProgress } from "./utils/cpUtils";
import { DialogOptions } from "./utils/uiUtils";
import { DialogOptions, openUrl } from "./utils/uiUtils";
import * as wsl from "./utils/wslUtils";

class LeetCodeExecutor {
Expand Down Expand Up @@ -38,7 +37,7 @@ class LeetCodeExecutor {
DialogOptions.open,
);
if (choice === DialogOptions.open) {
opn("https://nodejs.org");
openUrl("https://nodejs.org");
}
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions src/utils/uiUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) jdneo. All rights reserved.
// Licensed under the MIT license.

import * as opn from "opn";
import * as vscode from "vscode";
import { isLeetCodeCnEnabled } from "../commands/plugin";
import { leetCodeChannel } from "../leetCodeChannel";
Expand Down Expand Up @@ -48,9 +47,9 @@ export async function promptForSignIn(): Promise<void> {
break;
case DialogOptions.singUp:
if (isLeetCodeCnEnabled()) {
opn("https://leetcode-cn.com");
openUrl("https://leetcode-cn.com");
} else {
opn("https://leetcode.com");
openUrl("https://leetcode.com");
}
break;
default:
Expand All @@ -70,6 +69,10 @@ export async function showFileSelectDialog(): Promise<vscode.Uri[] | undefined>
return await vscode.window.showOpenDialog(options);
}

export async function openUrl(url: string): Promise<void> {
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(url));
}

export enum DialogType {
info = "info",
warning = "warning",
Expand Down