提交 9761315d 编写于 作者: M Matt Bierner

Fix TS version status not showing up when you first open VS Code

上级 229ab747
......@@ -379,12 +379,12 @@ export class TypeScriptServiceClientHost implements ITypeScriptServiceClientHost
configFileWatcher.onDidDelete(handleProjectCreateOrDelete, this, this.disposables);
configFileWatcher.onDidChange(handleProjectChange, this, this.disposables);
this.versionStatus = new VersionStatus(resource => this.client ? this.client.normalizePath(resource) : null);
this.disposables.push(this.versionStatus);
this.client = new TypeScriptServiceClient(this, workspaceState, this.versionStatus, plugins);
this.client = new TypeScriptServiceClient(this, workspaceState, version => this.versionStatus.onDidChangeTypeScriptVersion(version), plugins);
this.disposables.push(this.client);
this.versionStatus = new VersionStatus(resource => this.client.normalizePath(resource));
this.disposables.push(this.versionStatus);
this.typingsStatus = new TypingsStatus(this.client);
this.ataProgressReporter = new AtaProgressReporter(this.client);
......@@ -395,6 +395,7 @@ export class TypeScriptServiceClientHost implements ITypeScriptServiceClientHost
this.languagePerId.set(description.id, manager);
}
this.client.startService();
this.client.onReady().then(() => {
if (!this.client.apiVersion.has230Features()) {
return;
......
......@@ -17,7 +17,6 @@ import { ITypeScriptServiceClient, ITypeScriptServiceClientHost } from './typesc
import { TypeScriptServerPlugin } from './utils/plugins';
import Logger from './utils/logger';
import VersionStatus from './utils/versionStatus';
import * as is from './utils/is';
import TelemetryReporter from './utils/telemetry';
import Tracer from './utils/tracer';
......@@ -153,7 +152,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
constructor(
private readonly host: ITypeScriptServiceClientHost,
private readonly workspaceState: Memento,
private readonly versionStatus: VersionStatus,
private readonly onDidChangeTypeScriptVersion: (version: TypeScriptVersion) => void,
public readonly plugins: TypeScriptServerPlugin[]
) {
this.pathSeparator = path.sep;
......@@ -199,7 +198,6 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
}, this, this.disposables);
this.telemetryReporter = new TelemetryReporter(() => this._tsserverVersion || this._apiVersion.versionString);
this.disposables.push(this.telemetryReporter);
this.startService();
}
public get configuration() {
......@@ -301,7 +299,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
return Promise.reject<cp.ChildProcess>(new Error('Could not create TS service'));
}
private startService(resendModels: boolean = false): Thenable<cp.ChildProcess> {
public startService(resendModels: boolean = false): Thenable<cp.ChildProcess> {
let currentVersion = this.versionPicker.currentVersion;
return this.servicePromise = new Promise<cp.ChildProcess>((resolve, reject) => {
......@@ -314,7 +312,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
}
this._apiVersion = this.versionPicker.currentVersion.version || API.defaultVersion;
this.versionStatus.onDidChangeTypeScriptVersion(currentVersion);
this.onDidChangeTypeScriptVersion(currentVersion);
this.requestQueue = new RequestQueue();
this.callbacks = new CallbackMap();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册