diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2e50ca59b97..9f0062cfd71 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -583,7 +583,7 @@ module Harness.LanguageService { // This host is just a proxy for the clientHost, it uses the client // host to answer server queries about files on disk var serverHost = new SessionServerHost(clientHost); - var server = new ts.server.Session(serverHost, serverHost, /*useProtocol*/ true, /*prettyJSON*/ false); + var server = new ts.server.Session(serverHost, serverHost); // Fake the connection between the client and the server serverHost.writeMessage = client.onMessage.bind(client); diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 16abbf029d7..b9eb72a78ed 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -157,7 +157,7 @@ module ts.server { immediateId: any; changeSeq = 0; - constructor(private host: ServerHost, private logger: Logger, protected useProtocol: boolean, protected prettyJSON: boolean) { + constructor(private host: ServerHost, private logger: Logger) { this.projectService = new ProjectService(host, logger); } @@ -178,13 +178,7 @@ module ts.server { } send(msg: NodeJS._debugger.Message) { - var json: string; - if (this.prettyJSON) { - json = JSON.stringify(msg, null, " "); - } - else { - json = JSON.stringify(msg); - } + var json = JSON.stringify(msg); this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + '\r\n\r\n' + json); } @@ -229,32 +223,7 @@ module ts.server { } output(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { - if (this.useProtocol) { - this.response(info, cmdName, reqSeq, errorMsg); - } - else if (this.prettyJSON) { - if (!errorMsg) { - this.sendLineToClient(JSON.stringify(info, null, " ").trim()); - } - else { - this.sendLineToClient(JSON.stringify(errorMsg)); - } - } else { - if (!errorMsg) { - var infoStr = JSON.stringify(info).trim(); - // [8 digits of length,infoStr] + '\n' - var len = infoStr.length + paddedLength + 4; - var lenStr = len.toString(); - var padLen = paddedLength - lenStr.length; - for (var i = 0; i < padLen; i++) { - lenStr = '0' + lenStr; - } - this.sendLineToClient("[" + lenStr + "," + infoStr + "]"); - } - else { - this.sendLineToClient(JSON.stringify("error: " + errorMsg)); - } - } + this.response(info, cmdName, reqSeq, errorMsg); } semanticCheck(file: string, project: Project) { diff --git a/src/server/server.ts b/src/server/server.ts index 9f06e9b0277..974fb491674 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -73,26 +73,8 @@ module ts.server { } class IOSession extends Session { - protocol: NodeJS._debugger.Protocol; - - constructor(host: ServerHost, logger: ts.server.Logger, useProtocol: boolean, prettyJSON: boolean) { - super(host, logger, useProtocol, prettyJSON); - if (useProtocol) { - this.initProtocol(); - } - } - - initProtocol() { - this.protocol = new nodeproto.Protocol(); - // note: onResponse was named by nodejs authors; we are re-purposing the Protocol - // class in this case so that it supports a server instead of a client - this.protocol.onResponse = (pkt) => { - this.handleRequest(pkt); - }; - } - - handleRequest(req: NodeJS._debugger.Packet) { - this.projectService.log("Got JSON msg:\n" + req.raw); + constructor(host: ServerHost, logger: ts.server.Logger) { + super(host, logger); } listen() { @@ -114,5 +96,5 @@ module ts.server { var logger = new Logger(__dirname + "/.log" + process.pid.toString()); // Start listening - new IOSession(ts.sys, logger, /* useProtocol */ true, /* prettyJSON */ false).listen(); + new IOSession(ts.sys, logger).listen(); } \ No newline at end of file