Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhanced Tree view#94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdneo merged 14 commits intoLeetCode-OpenSource:masterfromVigilans:tag-search
Feb 2, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
e90b44e
Add company plugin check
VigilansJan 22, 2019
c1a58b2
Store leetcode-cli root path in LeetCodeExecutor instead of binary path
VigilansJan 22, 2019
ce204b9
Add companies and tags information to IProblem
VigilansJan 22, 2019
236a020
Add category tree view to explorer
VigilansJan 22, 2019
64badc5
Add `require-from-string` dependency
VigilansJan 23, 2019
d648f8a
Move getCompaniesAndTags from `list.ts` to `leetCodeExecutor.ts`
VigilansJan 23, 2019
21723fe
Minor fixes
VigilansJan 23, 2019
39071bf
Capitalize label name and sort labels
VigilansJan 23, 2019
3cb8743
Add favorite tree view
VigilansJan 23, 2019
86f17ac
Fix lint errors
VigilansJan 23, 2019
7e00062
Show AC/NotAC problems in treeview
VigilansJan 24, 2019
0153d84
Revert "Show AC/NotAC problems in treeview"
VigilansJan 24, 2019
d9abd5f
Option to hide solved problems
VigilansJan 24, 2019
7bffd54
Refactor
jdneoFeb 2, 2019
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
55 changes: 33 additions & 22 deletionspackage-lock.json
View file
Open in desktop

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

10 changes: 9 additions & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -193,6 +193,12 @@
{
"title": "LeetCode",
"properties": {
"leetcode.hideSolved": {
"type": "boolean",
"default": false,
"scope": "application",
"description": "Hide solved problems."
},
"leetcode.showLocked": {
"type": "boolean",
"default": false,
Expand DownExpand Up@@ -258,12 +264,14 @@
"@types/fs-extra": "5.0.0",
"@types/mocha": "^2.2.42",
"@types/node": "^7.0.43",
"@types/require-from-string": "^1.2.0",
"tslint": "^5.9.1",
"typescript": "^2.6.1",
"vscode": "^1.1.22"
},
"dependencies": {
"fs-extra": "^6.0.1",
"leetcode-cli": "2.6.1"
"leetcode-cli": "2.6.1",
"require-from-string": "^2.0.2"
}
}
20 changes: 7 additions & 13 deletionssrc/commands/list.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,19 +4,9 @@
import * as vscode from "vscode";
import { leetCodeExecutor } from "../leetCodeExecutor";
import { leetCodeManager } from "../leetCodeManager";
import { ProblemState, UserStatus } from "../shared";
import {IProblem,ProblemState, UserStatus } from "../shared";
import { DialogType, promptForOpenOutputChannel } from "../utils/uiUtils";

export interface IProblem {
favorite: boolean;
locked: boolean;
state: ProblemState;
id: string;
name: string;
difficulty: string;
passRate: string;
}

export async function listProblems(): Promise<IProblem[]> {
try {
if (leetCodeManager.getStatus() === UserStatus.SignedOut) {
Expand All@@ -28,17 +18,21 @@ export async function listProblems(): Promise<IProblem[]> {
const problems: IProblem[] = [];
const lines: string[] = result.split("\n");
const reg: RegExp = /^(.)\s(.{1,2})\s(.)\s\[\s*(\d*)\s*\]\s*(.*)\s*(Easy|Medium|Hard)\s*\((\s*\d+\.\d+ %)\)/;
const { companies, tags } = await leetCodeExecutor.getCompaniesAndTags();
for (const line of lines) {
const match: RegExpMatchArray | null = line.match(reg);
if (match && match.length === 8) {
const id: string = match[4].trim();
problems.push({
favorite: match[1].trim().length > 0,
id,
isFavorite: match[1].trim().length > 0,
locked: match[2].trim().length > 0,
state: parseProblemState(match[3]),
id: match[4].trim(),
name: match[5].trim(),
difficulty: match[6].trim(),
passRate: match[7].trim(),
companies: companies[id] || ["Unknown"],
tags: tags[id] || ["Unknown"],
});
}
}
Expand Down
8 changes: 4 additions & 4 deletionssrc/commands/show.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,10 +3,10 @@

import * as fse from "fs-extra";
import * as vscode from "vscode";
import { LeetCodeNode } from "../explorer/LeetCodeNode";
import { leetCodeExecutor } from "../leetCodeExecutor";
import { LeetCodeNode } from "../leetCodeExplorer";
import { leetCodeManager } from "../leetCodeManager";
import { IQuickItemEx, languages, ProblemState } from "../shared";
import {IProblem,IQuickItemEx, languages, ProblemState } from "../shared";
import { DialogOptions, DialogType, promptForOpenOutputChannel, promptForSignIn } from "../utils/uiUtils";
import { selectWorkspaceFolder } from "../utils/workspaceUtils";
import * as wsl from "../utils/wslUtils";
Expand DownExpand Up@@ -80,9 +80,9 @@ async function showProblemInternal(id: string): Promise<void> {
}
}

async function parseProblemsToPicks(p: Promise<list.IProblem[]>): Promise<Array<IQuickItemEx<string>>> {
async function parseProblemsToPicks(p: Promise<IProblem[]>): Promise<Array<IQuickItemEx<string>>> {
return new Promise(async (resolve: (res: Array<IQuickItemEx<string>>) => void): Promise<void> => {
const picks: Array<IQuickItemEx<string>> = (await p).map((problem:list.IProblem) => Object.assign({}, {
const picks: Array<IQuickItemEx<string>> = (await p).map((problem: IProblem) => Object.assign({}, {
label: `${parseProblemDecorator(problem.state, problem.locked)}${problem.id}.${problem.name}`,
description: "",
detail: `AC rate: ${problem.passRate}, Difficulty: ${problem.difficulty}`,
Expand Down
51 changes: 51 additions & 0 deletionssrc/explorer/LeetCodeNode.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
// Copyright (c) jdneo. All rights reserved.
// Licensed under the MIT license.

import { IProblem, ProblemState } from "../shared";

export class LeetCodeNode {
constructor(private data: IProblem, private parentNodeName: string, private isProblemNode: boolean = true) { }

public get locked(): boolean {
return this.data.locked;
}
public get name(): string {
return this.data.name;
}

public get state(): ProblemState {
return this.data.state;
}

public get id(): string {
return this.data.id;
}

public get passRate(): string {
return this.data.passRate;
}

public get difficulty(): string {
return this.data.difficulty;
}

public get tags(): string[] {
return this.data.tags;
}

public get companies(): string[] {
return this.data.companies;
}

public get isFavorite(): boolean {
return this.data.isFavorite;
}

public get isProblem(): boolean {
return this.isProblemNode;
}

public get parentName(): string {
return this.parentNodeName;
}
}
Loading

[8]ページ先頭

©2009-2025 Movatter.jp