提交 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) {
case 'syntaxDiag':
this.host.syntaxDiagnosticsReceived(event as Proto.DiagnosticEvent); this.host.syntaxDiagnosticsReceived(event as Proto.DiagnosticEvent);
} else if (event.event === 'semanticDiag') { break;
case 'semanticDiag':
this.host.semanticDiagnosticsReceived(event as Proto.DiagnosticEvent); this.host.semanticDiagnosticsReceived(event as Proto.DiagnosticEvent);
} else if (event.event === 'configFileDiag') { break;
case 'configFileDiag':
this.host.configFileDiagnosticsReceived(event as Proto.ConfigFileDiagnosticEvent); this.host.configFileDiagnosticsReceived(event as Proto.ConfigFileDiagnosticEvent);
} else if (event.event === 'telemetry') { break;
case 'telemetry':
const telemetryData = (event as Proto.TelemetryEvent).body; const telemetryData = (event as Proto.TelemetryEvent).body;
this.dispatchTelemetryEvent(telemetryData); this.dispatchTelemetryEvent(telemetryData);
} else if (event.event === 'projectLanguageServiceState') { break;
case 'projectLanguageServiceState':
if (event.body) {
const data = (event as Proto.ProjectLanguageServiceStateEvent).body; const data = (event as Proto.ProjectLanguageServiceStateEvent).body;
if (data) {
this._onProjectLanguageServiceStateChanged.fire(data); this._onProjectLanguageServiceStateChanged.fire(data);
} }
} else if (event.event === 'beginInstallTypes') { break;
case 'beginInstallTypes':
if (event.body) {
const data = (event as Proto.BeginInstallTypesEvent).body; const data = (event as Proto.BeginInstallTypesEvent).body;
if (data) {
this._onDidBeginInstallTypings.fire(data); this._onDidBeginInstallTypings.fire(data);
} }
} else if (event.event === 'endInstallTypes') { break;
case 'endInstallTypes':
if (event.body) {
const data = (event as Proto.EndInstallTypesEvent).body; const data = (event as Proto.EndInstallTypesEvent).body;
if (data) {
this._onDidEndInstallTypings.fire(data); this._onDidEndInstallTypings.fire(data);
} }
} else if (event.event === 'typesInstallerInitializationFailed') { break;
case 'typesInstallerInitializationFailed':
if (event.body) {
const data = (event as Proto.TypesInstallerInitializationFailedEvent).body; const data = (event as Proto.TypesInstallerInitializationFailedEvent).body;
if (data) {
this._onTypesInstallerInitializationFailed.fire(data); this._onTypesInstallerInitializationFailed.fire(data);
} }
break;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册