mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
send requests per provider so that a hanging provider doesn't block other providers, https://github.com/microsoft/vscode/issues/100524
This commit is contained in:
@@ -1525,7 +1525,6 @@ export interface ExtHostDebugServiceShape {
|
||||
|
||||
export interface DecorationRequest {
|
||||
readonly id: number;
|
||||
readonly handle: number;
|
||||
readonly uri: UriComponents;
|
||||
}
|
||||
|
||||
@@ -1533,7 +1532,7 @@ export type DecorationData = [number, boolean, string, string, ThemeColor];
|
||||
export type DecorationReply = { [id: number]: DecorationData; };
|
||||
|
||||
export interface ExtHostDecorationsShape {
|
||||
$provideDecorations(requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply>;
|
||||
$provideDecorations(handle: number, requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply>;
|
||||
}
|
||||
|
||||
export interface ExtHostWindowShape {
|
||||
|
||||
@@ -52,17 +52,20 @@ export class ExtHostDecorations implements IExtHostDecorations {
|
||||
});
|
||||
}
|
||||
|
||||
$provideDecorations(requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply> {
|
||||
async $provideDecorations(handle: number, requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply> {
|
||||
|
||||
if (!this._provider.has(handle)) {
|
||||
// might have been unregistered in the meantime
|
||||
return Object.create(null);
|
||||
}
|
||||
|
||||
const result: DecorationReply = Object.create(null);
|
||||
return Promise.all(requests.map(request => {
|
||||
const { handle, uri, id } = request;
|
||||
const entry = this._provider.get(handle);
|
||||
if (!entry) {
|
||||
// might have been unregistered in the meantime
|
||||
return undefined;
|
||||
}
|
||||
const { provider, extensionId } = entry;
|
||||
return Promise.resolve(provider.provideDecoration(URI.revive(uri), token)).then(data => {
|
||||
const { provider, extensionId } = this._provider.get(handle)!;
|
||||
|
||||
await Promise.all(requests.map(async request => {
|
||||
try {
|
||||
const { uri, id } = request;
|
||||
const data = await Promise.resolve(provider.provideDecoration(URI.revive(uri), token));
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
@@ -72,13 +75,12 @@ export class ExtHostDecorations implements IExtHostDecorations {
|
||||
} catch (e) {
|
||||
this._logService.warn(`INVALID decoration from extension '${extensionId.value}': ${e}`);
|
||||
}
|
||||
}, err => {
|
||||
} catch (err) {
|
||||
this._logService.error(err);
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
})).then(() => {
|
||||
return result;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user