提交 aca46ac4 编写于 作者: M Matt Bierner

Take server arguments object

Makes it more difficult to mistaktenly reverse which server is which
上级 c8516dd7
......@@ -298,21 +298,26 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe
export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServer {
private readonly syntaxServer: ITypeScriptServer;
private readonly semanticServer: ITypeScriptServer;
public constructor(
private readonly syntaxServer: ITypeScriptServer,
private readonly semanticServer: ITypeScriptServer,
servers: { syntax: ITypeScriptServer, semantic: ITypeScriptServer },
private readonly _delegate: TsServerDelegate,
) {
super();
this._register(syntaxServer.onEvent(e => this._onEvent.fire(e)));
this._register(semanticServer.onEvent(e => this._onEvent.fire(e)));
this.syntaxServer = servers.syntax;
this.semanticServer = servers.semantic;
this._register(this.syntaxServer.onEvent(e => this._onEvent.fire(e)));
this._register(this.semanticServer.onEvent(e => this._onEvent.fire(e)));
this._register(semanticServer.onExit(e => {
this._register(this.semanticServer.onExit(e => {
this._onExit.fire(e);
this.syntaxServer.kill();
}));
this._register(semanticServer.onError(e => this._onError.fire(e)));
this._register(this.semanticServer.onError(e => this._onError.fire(e)));
}
private readonly _onEvent = this._register(new vscode.EventEmitter<Proto.Event>());
......@@ -425,6 +430,7 @@ export class SyntaxRoutingTsServer extends Disposable implements ITypeScriptServ
}
}
namespace RequestState {
export const enum Type { Unresolved, Resolved, Errored }
......
......@@ -41,7 +41,7 @@ export class TypeScriptServerSpawner {
if (this.shouldUseSeparateSyntaxServer(version, configuration)) {
const syntaxServer = this.spawnTsServer('syntax', version, configuration, pluginManager);
const semanticServer = this.spawnTsServer('semantic', version, configuration, pluginManager);
return new SyntaxRoutingTsServer(syntaxServer, semanticServer, delegate);
return new SyntaxRoutingTsServer({ syntax: syntaxServer, semantic: semanticServer }, delegate);
}
return this.spawnTsServer('main', version, configuration, pluginManager);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册