Skip to content

Commit

Permalink
RPC Protocol ClientProxyHandler Init Events #13172
Browse files Browse the repository at this point in the history
* don't throw error on possible race condition but log only
* initialize dependencies before resolving promise
  • Loading branch information
jfaltermeier committed Jan 3, 2024
1 parent 9976a01 commit 966d462
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/common/proxy-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ export class ClientProxyHandler<T extends object> implements ProxyHandler<T> {
const clientOptions: RpcProtocolOptions = { encoder: this.encoder, decoder: this.decoder, mode: 'clientOnly' };
this.channelProvider().then(channel => {
const rpc = new RpcProtocol(channel, undefined, clientOptions);
this.rpcDeferred.resolve(rpc);
this.isRpcInitialized = true;
this.isInitializing = false;
if (this.onInitialize) {
this.onInitialize();
}
this.rpcDeferred.resolve(rpc);
this.isInitializing = false;
});
}
}
Expand Down
6 changes: 4 additions & 2 deletions packages/plugin-ext/src/plugin/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ export class DocumentsExtImpl implements DocumentsExt {
const uriString = uri.toString();
const data = this.editorsAndDocuments.getDocument(uriString);
if (!data) {
throw new Error('unknown document: ' + uriString);
console.error('unknown document: ' + uriString);
return;
}
data.acceptIsDirty(isDirty);
this._onDidChangeDocument.fire({
Expand All @@ -172,7 +173,8 @@ export class DocumentsExtImpl implements DocumentsExt {
const uriString = uri.toString();
const data = this.editorsAndDocuments.getDocument(uriString);
if (!data) {
throw new Error('unknown document: ' + uriString);
console.error('unknown document: ' + uriString);
return;
}
data.acceptIsDirty(isDirty);
data.onEvents(e);
Expand Down

0 comments on commit 966d462

Please sign in to comment.