forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseDebugServer.ts
More file actions
36 lines (32 loc) · 1.25 KB
/
Copy pathBaseDebugServer.ts
File metadata and controls
36 lines (32 loc) · 1.25 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
// tslint:disable:quotemark ordered-imports no-any no-empty
"use strict";
import { DebugSession } from "vscode-debugadapter";
import { IPythonProcess, IDebugServer } from "../Common/Contracts";
import { EventEmitter } from "events";
import { Deferred, createDeferred } from '../../common/helpers';
import { Socket } from 'net';
export abstract class BaseDebugServer extends EventEmitter {
protected clientSocket: Deferred<Socket>;
public get client(): Promise<Socket> {
return this.clientSocket.promise;
}
protected pythonProcess: IPythonProcess;
protected debugSession: DebugSession;
protected isRunning: boolean;
public get IsRunning(): boolean {
return this.isRunning;
}
protected debugClientConnected: Deferred<boolean>;
public get DebugClientConnected(): Promise<boolean> {
return this.debugClientConnected.promise;
}
constructor(debugSession: DebugSession, pythonProcess?: IPythonProcess) {
super();
this.debugSession = debugSession;
this.pythonProcess = pythonProcess!;
this.debugClientConnected = createDeferred<boolean>();
this.clientSocket = createDeferred<Socket>();
}
public abstract Start(): Promise<IDebugServer>;
public abstract Stop();
}