Skip to content

Remove interface declaration #81

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2018
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install && node ./node_modules/leetcode-cli/bin/leetcode plugin -e leetcode.cn",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"lint": "tslint --project tsconfig.json -e src/*.d.ts -t verbose"
},
Expand Down
5 changes: 3 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
const leetCodeTreeDataProvider: LeetCodeTreeDataProvider = new LeetCodeTreeDataProvider(context);

context.subscriptions.push(
leetCodeStatusBarItem,
leetCodeChannel,
vscode.window.registerTreeDataProvider("leetCodeExplorer", leetCodeTreeDataProvider),
vscode.commands.registerCommand("leetcode.deleteCache", () => cache.deleteCache()),
vscode.commands.registerCommand("leetcode.toogleLeetCodeCn", () => plugin.toogleLeetCodeCn()),
Expand All @@ -45,6 +47,5 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
}

export function deactivate(): void {
leetCodeStatusBarItem.dispose();
leetCodeChannel.dispose();
// Do nothing.
}
11 changes: 2 additions & 9 deletions src/leetCodeChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@

import * as vscode from "vscode";

export interface ILeetCodeChannel {
appendLine(message: any, title?: string): void;
append(message: any): void;
show(): void;
dispose(): void;
}

class LeetCodeChannel implements ILeetCodeChannel {
class LeetCodeChannel implements vscode.Disposable {
private readonly channel: vscode.OutputChannel = vscode.window.createOutputChannel("LeetCode");

public appendLine(message: string): void {
Expand All @@ -30,4 +23,4 @@ class LeetCodeChannel implements ILeetCodeChannel {
}
}

export const leetCodeChannel: ILeetCodeChannel = new LeetCodeChannel();
export const leetCodeChannel: LeetCodeChannel = new LeetCodeChannel();
34 changes: 2 additions & 32 deletions src/leetCodeExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,7 @@ import { executeCommand, executeCommandWithProgress } from "./utils/cpUtils";
import { DialogOptions } from "./utils/uiUtils";
import * as wsl from "./utils/wslUtils";

export interface ILeetCodeExecutor {
meetRequirements(): Promise<boolean>;
getLeetCodeBinaryPath(): Promise<string>;

/* section for cache command */
deleteCache(): Promise<string>;

/* section for user command */
getUserInfo(): Promise<string>;
signOut(): Promise<string>;
// TODO: implement login when leetcode-cli support login in batch mode.
// signIn(): Promise<string>;

/* section for problem command */
listProblems(showLocked: boolean): Promise<string>;
showProblem(id: string, language: string, outdir: string): Promise<string>;

/* section for session command */
listSessions(): Promise<string>;
enableSession(name: string): Promise<string>;
createSession(name: string): Promise<string>;

/* section for solution command */
submitSolution(filePath: string): Promise<string>;
testSolution(filePath: string, testString?: string): Promise<string>;

/* section for plugin command */
toggleLeetCodeCn(isEnable: boolean): Promise<string>;
}

class LeetCodeExecutor implements ILeetCodeExecutor {
class LeetCodeExecutor {
private leetCodeBinaryPath: string;
private leetCodeBinaryPathInWsl: string;

Expand Down Expand Up @@ -142,4 +112,4 @@ class LeetCodeExecutor implements ILeetCodeExecutor {
}
}

export const leetCodeExecutor: ILeetCodeExecutor = new LeetCodeExecutor();
export const leetCodeExecutor: LeetCodeExecutor = new LeetCodeExecutor();
12 changes: 2 additions & 10 deletions src/leetCodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ import { UserStatus } from "./shared";
import { DialogType, promptForOpenOutputChannel } from "./utils/uiUtils";
import * as wsl from "./utils/wslUtils";

export interface ILeetCodeManager extends EventEmitter {
getLoginStatus(): void;
getStatus(): UserStatus;
getUser(): string | undefined;
signIn(): void;
signOut(): void;
}

class LeetCodeManager extends EventEmitter implements ILeetCodeManager {
class LeetCodeManager extends EventEmitter {
private currentUser: string | undefined;
private userStatus: UserStatus;

Expand Down Expand Up @@ -123,4 +115,4 @@ class LeetCodeManager extends EventEmitter implements ILeetCodeManager {
}
}

export const leetCodeManager: ILeetCodeManager = new LeetCodeManager();
export const leetCodeManager: LeetCodeManager = new LeetCodeManager();
9 changes: 2 additions & 7 deletions src/leetCodeStatusBarItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import * as vscode from "vscode";
import { UserStatus } from "./shared";

export interface ILeetCodeStatusBarItem {
updateStatusBar(status: UserStatus, user?: string): void;
dispose(): void;
}

class LeetCodeStatusBarItem implements ILeetCodeStatusBarItem {
class LeetCodeStatusBarItem implements vscode.Disposable {
private readonly statusBarItem: vscode.StatusBarItem;

constructor() {
Expand All @@ -35,4 +30,4 @@ class LeetCodeStatusBarItem implements ILeetCodeStatusBarItem {
}
}

export const leetCodeStatusBarItem: ILeetCodeStatusBarItem = new LeetCodeStatusBarItem();
export const leetCodeStatusBarItem: LeetCodeStatusBarItem = new LeetCodeStatusBarItem();