diff --git a/package-lock.json b/package-lock.json index 7bf333d9..2c1422a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1840,11 +1840,6 @@ "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", "dev": true }, - "is-wsl": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", - "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" - }, "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", @@ -2595,14 +2590,6 @@ "mimic-fn": "^1.0.0" } }, - "opn": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/opn/-/opn-5.4.0.tgz", - "integrity": "sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw==", - "requires": { - "is-wsl": "^1.1.0" - } - }, "optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", diff --git a/package.json b/package.json index 3e41e674..ed290139 100644 --- a/package.json +++ b/package.json @@ -258,7 +258,6 @@ }, "dependencies": { "fs-extra": "^6.0.1", - "leetcode-cli": "2.6.1", - "opn": "^5.2.0" + "leetcode-cli": "2.6.1" } } diff --git a/src/leetCodeExecutor.ts b/src/leetCodeExecutor.ts index 3a656c5c..f8906f62 100644 --- a/src/leetCodeExecutor.ts +++ b/src/leetCodeExecutor.ts @@ -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 { @@ -38,7 +37,7 @@ class LeetCodeExecutor { DialogOptions.open, ); if (choice === DialogOptions.open) { - opn("https://nodejs.org"); + openUrl("https://nodejs.org"); } return false; } diff --git a/src/utils/uiUtils.ts b/src/utils/uiUtils.ts index 43c88cbe..aeb76ee6 100644 --- a/src/utils/uiUtils.ts +++ b/src/utils/uiUtils.ts @@ -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"; @@ -48,9 +47,9 @@ export async function promptForSignIn(): Promise { 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: @@ -70,6 +69,10 @@ export async function showFileSelectDialog(): Promise return await vscode.window.showOpenDialog(options); } +export async function openUrl(url: string): Promise { + vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(url)); +} + export enum DialogType { info = "info", warning = "warning",