We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d330913 commit 64683e7Copy full SHA for 64683e7
src/commands/show.ts
@@ -9,7 +9,7 @@ import { executeCommand } from "../utils/cpUtils";
9
import { DialogOptions, DialogType, promptForOpenOutputChannel, promptForSignIn } from "../utils/uiUtils";
10
import { selectWorkspaceFolder } from "../utils/workspaceUtils";
11
import * as list from "./list";
12
-import * as wsl from '../utils/wslUtils';
+import * as wsl from "../utils/wslUtils";
13
14
export async function showProblem(channel: vscode.OutputChannel, node?: LeetCodeNode): Promise<void> {
15
if (!node) {
@@ -54,7 +54,7 @@ async function showProblemInternal(channel: vscode.OutputChannel, id: string): P
54
const reg: RegExp = /\*SourceCode:\s*(.*)/;
55
const match: RegExpMatchArray | null = result.match(reg);
56
if (match && match.length >= 2) {
57
- const filePath = wsl.useWsl() ? wsl.toWinPath(match[1].trim()) : match[1].trim()
+ const filePath = wsl.useWsl() ? wsl.toWinPath(match[1].trim()) : match[1].trim();
58
59
await vscode.window.showTextDocument(vscode.Uri.file(filePath), { preview: false });
60
} else {
src/leetCodeManager.ts
@@ -7,7 +7,7 @@ import { UserStatus } from "./shared";
7
import { leetCodeBinaryPath } from "./shared";
8
import { executeCommand } from "./utils/cpUtils";
import { DialogType, promptForOpenOutputChannel } from "./utils/uiUtils";
-import * as wsl from './utils/wslUtils'
+import * as wsl from "./utils/wslUtils"
export interface ILeetCodeManager extends EventEmitter {
getLoginStatus(channel: vscode.OutputChannel): void;
@@ -46,7 +46,7 @@ class LeetCodeManager extends EventEmitter implements ILeetCodeManager {
46
let result: string = "";
47
48
const childProc: cp.ChildProcess = wsl.useWsl()
49
- ? cp.spawn("wsl", ['--','node', leetCodeBinaryPath, "user", "-l"], { shell: true })
+ ? cp.spawn("wsl", ["--","node", leetCodeBinaryPath, "user", "-l"], { shell: true })
50
: cp.spawn("node", [leetCodeBinaryPath, "user", "-l"], { shell: true });
51
52
childProc.stdout.on("data", (data: string | Buffer) => {
src/shared.ts
@@ -2,12 +2,12 @@
2
3
import * as path from "path";
4
import * as vscode from "vscode";
5
+import * as wsl from "./utils/wslUtils";
6
-let binPath = path.join(__dirname, "..", "..", "node_modules", "leetcode-cli", "bin", "leetcode")
+let binPath = path.join(__dirname, "..", "..", "node_modules", "leetcode-cli", "bin", "leetcode");
if (wsl.useWsl()) {
- binPath = wsl.toWslPath(binPath)
+ binPath = wsl.toWslPath(binPath);
}
export const leetCodeBinaryPath: string = `"${binPath}"`;
src/utils/cpUtils.ts
@@ -2,14 +2,14 @@
import * as cp from "child_process";
-import * as wsl from './wslUtils'
+import * as wsl from "./wslUtils"
export async function executeCommand(channel: vscode.OutputChannel, command: string, args: string[], options: cp.SpawnOptions = { shell: true }): Promise<string> {
return new Promise((resolve: (res: string) => void, reject: (e: Error) => void): void => {
- ? cp.spawn('wsl', ['--', command].concat(args), options)
+ ? cp.spawn("wsl", ["--", command].concat(args), options)
: cp.spawn(command, args, options);
src/utils/workspaceUtils.ts
@@ -19,7 +19,7 @@ export async function selectWorkspaceFolder(): Promise<string> {
19
20
const workFolder = folder ? folder.uri.fsPath : path.join(os.homedir(), ".leetcode");
21
22
- return wsl.useWsl() ? wsl.toWslPath(workFolder) : workFolder
+ return wsl.useWsl() ? wsl.toWslPath(workFolder) : workFolder;
23
24
25
export async function getActivefilePath(uri?: vscode.Uri): Promise<string | undefined> {
src/utils/wslUtils.ts
@@ -6,13 +6,13 @@ import * as vscode from "vscode";
export function useWsl(): boolean {
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode");
- return process.platform === 'win32' && leetCodeConfig.get<boolean>('useWsl') === true
+ return process.platform === "win32" && leetCodeConfig.get<boolean>("useWsl") === true;
export function toWslPath(path: string): string {
- return cp.execFileSync('wsl', ['--','wslpath','-u', `${path.replace(/\\/g, '/')}`]).toString().trim()
+ return cp.execFileSync("wsl", ["--","wslpath","-u", `${path.replace(/\\/g, "/")}`]).toString().trim();
16
export function toWinPath(path: string): string {
17
- return cp.execFileSync('wsl', ['--','wslpath','-w', path]).toString().trim()
+ return cp.execFileSync("wsl", ["--","wslpath","-w", path]).toString().trim();
18
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments