mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Take server arguments object
Makes it more difficult to mistaktenly reverse which server is which
This commit is contained in:
@@ -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(semanticServer.onExit(e => {
|
||||
this._register(this.syntaxServer.onEvent(e => this._onEvent.fire(e)));
|
||||
this._register(this.semanticServer.onEvent(e => this._onEvent.fire(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);
|
||||
|
||||
Reference in New Issue
Block a user