Skip to content

Commit e09bce0

Browse files
committed
Use NodeProcess to start tsserver for compat
1 parent 74b6943 commit e09bce0

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

dist/client/client.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use strict";
22
const tslib_1 = require("tslib");
3-
const child_process_1 = require("child_process");
43
const events_1 = require("events");
54
const stream_1 = require("stream");
65
const byline = require("byline");
6+
const atom_1 = require("atom");
77
exports.CommandWithResponse = new Set([
88
"compileOnSaveAffectedFileList",
99
"compileOnSaveEmitFile",
@@ -149,13 +149,16 @@ class TypescriptServiceClient {
149149
if (!this.serverPromise) {
150150
this.serverPromise = new Promise((resolve, reject) => {
151151
// console.log("starting", this.tsServerPath)
152-
const cp = child_process_1.spawn(this.tsServerPath, this.tsServerArgs);
152+
const cp = new atom_1.BufferedNodeProcess({
153+
command: this.tsServerPath,
154+
args: this.tsServerArgs,
155+
}).process;
153156
cp.once("error", err => {
154-
// console.log("tsserver starting failed with", err)
157+
console.log("tsserver failed with", err);
155158
reject(err);
156159
});
157160
cp.once("exit", code => {
158-
// console.log("tsserver failed to start with code", code)
161+
console.log("tsserver failed to start with code", code);
159162
reject({ code });
160163
});
161164
messageStream(cp.stdout).on("data", this.onMessage);

lib/client/client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import {ChildProcess, spawn} from "child_process"
21
import {EventEmitter} from "events"
32
import {Transform, Readable} from "stream"
43
import * as protocol from "typescript/lib/protocol"
54
import byline = require("byline")
5+
import {BufferedNodeProcess} from "atom"
6+
import {ChildProcess} from "child_process"
67

78
export const CommandWithResponse = new Set([
89
"compileOnSaveAffectedFileList",
@@ -193,15 +194,18 @@ export class TypescriptServiceClient {
193194
this.serverPromise = new Promise<ChildProcess>((resolve, reject) => {
194195
// console.log("starting", this.tsServerPath)
195196

196-
const cp = spawn(this.tsServerPath, this.tsServerArgs)
197+
const cp = new BufferedNodeProcess({
198+
command: this.tsServerPath,
199+
args: this.tsServerArgs,
200+
}).process as any as ChildProcess
197201

198202
cp.once("error", err => {
199-
// console.log("tsserver starting failed with", err)
203+
console.log("tsserver failed with", err)
200204
reject(err)
201205
})
202206

203207
cp.once("exit", code => {
204-
// console.log("tsserver failed to start with code", code)
208+
console.log("tsserver failed to start with code", code)
205209
reject({code})
206210
})
207211

0 commit comments

Comments
 (0)