提交 39c64727 编写于 作者: M Matt Bierner

Convert dispatchEvent to switch

上级 4e5a574a
...@@ -730,35 +730,52 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient ...@@ -730,35 +730,52 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
} }
private dispatchEvent(event: Proto.Event) { private dispatchEvent(event: Proto.Event) {
if (event.event === 'syntaxDiag') { switch (event.event) {
this.host.syntaxDiagnosticsReceived(event as Proto.DiagnosticEvent); case 'syntaxDiag':
} else if (event.event === 'semanticDiag') { this.host.syntaxDiagnosticsReceived(event as Proto.DiagnosticEvent);
this.host.semanticDiagnosticsReceived(event as Proto.DiagnosticEvent); break;
} else if (event.event === 'configFileDiag') {
this.host.configFileDiagnosticsReceived(event as Proto.ConfigFileDiagnosticEvent); case 'semanticDiag':
} else if (event.event === 'telemetry') { this.host.semanticDiagnosticsReceived(event as Proto.DiagnosticEvent);
const telemetryData = (event as Proto.TelemetryEvent).body; break;
this.dispatchTelemetryEvent(telemetryData);
} else if (event.event === 'projectLanguageServiceState') { case 'configFileDiag':
const data = (event as Proto.ProjectLanguageServiceStateEvent).body; this.host.configFileDiagnosticsReceived(event as Proto.ConfigFileDiagnosticEvent);
if (data) { break;
this._onProjectLanguageServiceStateChanged.fire(data);
} case 'telemetry':
} else if (event.event === 'beginInstallTypes') { const telemetryData = (event as Proto.TelemetryEvent).body;
const data = (event as Proto.BeginInstallTypesEvent).body; this.dispatchTelemetryEvent(telemetryData);
if (data) { break;
this._onDidBeginInstallTypings.fire(data);
} case 'projectLanguageServiceState':
} else if (event.event === 'endInstallTypes') { if (event.body) {
const data = (event as Proto.EndInstallTypesEvent).body; const data = (event as Proto.ProjectLanguageServiceStateEvent).body;
if (data) {
this._onDidEndInstallTypings.fire(data); this._onProjectLanguageServiceStateChanged.fire(data);
} }
} else if (event.event === 'typesInstallerInitializationFailed') { break;
const data = (event as Proto.TypesInstallerInitializationFailedEvent).body;
if (data) { case 'beginInstallTypes':
this._onTypesInstallerInitializationFailed.fire(data); if (event.body) {
} const data = (event as Proto.BeginInstallTypesEvent).body;
this._onDidBeginInstallTypings.fire(data);
}
break;
case 'endInstallTypes':
if (event.body) {
const data = (event as Proto.EndInstallTypesEvent).body;
this._onDidEndInstallTypings.fire(data);
}
break;
case 'typesInstallerInitializationFailed':
if (event.body) {
const data = (event as Proto.TypesInstallerInitializationFailedEvent).body;
this._onTypesInstallerInitializationFailed.fire(data);
}
break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册