forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmockClasses.ts
More file actions
74 lines (65 loc) · 2.16 KB
/
mockClasses.ts
File metadata and controls
74 lines (65 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as vscode from 'vscode';
import * as util from 'util';
export class MockOutputChannel implements vscode.LogOutputChannel {
public name: string;
public output: string;
public isShown!: boolean;
private _eventEmitter = new vscode.EventEmitter<vscode.LogLevel>();
public onDidChangeLogLevel: vscode.Event<vscode.LogLevel> = this._eventEmitter.event;
constructor(name: string) {
this.name = name;
this.output = '';
this.logLevel = vscode.LogLevel.Debug;
}
public logLevel: vscode.LogLevel;
trace(message: string, ...args: any[]): void {
this.appendLine(util.format(message, ...args));
}
debug(message: string, ...args: any[]): void {
this.appendLine(util.format(message, ...args));
}
info(message: string, ...args: any[]): void {
this.appendLine(util.format(message, ...args));
}
warn(message: string, ...args: any[]): void {
this.appendLine(util.format(message, ...args));
}
error(error: string | Error, ...args: any[]): void {
this.appendLine(util.format(error, ...args));
}
public append(value: string) {
this.output += value;
}
public appendLine(value: string) {
this.append(value);
this.append('\n');
}
public replace(value: string): void {
this.output = value;
}
public clear() {}
public show(preservceFocus?: boolean): void;
public show(column?: vscode.ViewColumn, preserveFocus?: boolean): void;
public show(_x?: any, _y?: any): void {
this.isShown = true;
}
public hide() {
this.isShown = false;
}
public dispose() {}
}
export class MockStatusBarItem implements vscode.StatusBarItem {
backgroundColor: vscode.ThemeColor | undefined;
accessibilityInformation: vscode.AccessibilityInformation | undefined;
public alignment!: vscode.StatusBarAlignment;
public priority!: number;
public text!: string;
public tooltip!: string;
public color!: string;
public command!: string;
public id: string = '';
public name: string = '';
public show(): void {}
public hide(): void {}
public dispose(): void {}
}