Make sure we always reset bufferSyncSupport when the TS server is started

Splits `reset` from `reinitialize` and makes sure we always `resset` buffer sync support when the service starts
This commit is contained in:
Matt Bierner
2019-11-14 00:46:01 -08:00
parent 537fcc46d7
commit 88c2100793
3 changed files with 7 additions and 2 deletions

View File

@@ -401,7 +401,10 @@ export default class BufferSyncSupport extends Disposable {
this.pendingGetErr?.cancel();
this.pendingDiagnostics.clear();
this.synchronizer.reset();
}
public reinitialize(): void {
this.reset();
for (const buffer of this.syncedBuffers.allBuffers) {
buffer.open();
}

View File

@@ -182,8 +182,6 @@ export default class TypeScriptServiceClientHost extends Disposable {
private populateService(): void {
this.fileConfigurationManager.reset();
this.client.bufferSyncSupport.reset();
this.client.bufferSyncSupport.requestAllDiagnostics();
// See https://github.com/Microsoft/TypeScript/issues/5530
vscode.workspace.saveAll(false).then(() => {

View File

@@ -465,6 +465,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
private serviceStarted(resendModels: boolean): void {
this.bufferSyncSupport.reset();
const configureOptions: Proto.ConfigureRequestArguments = {
hostInfo: 'vscode',
preferences: {
@@ -476,6 +478,8 @@ export default class TypeScriptServiceClient extends Disposable implements IType
this.setCompilerOptionsForInferredProjects(this._configuration);
if (resendModels) {
this._onResendModelsRequested.fire();
this.bufferSyncSupport.reinitialize();
this.bufferSyncSupport.requestAllDiagnostics();
}
// Reconfigure any plugins