Skip to content

Commit 499a93c

Browse files
authored
Merge pull request microsoft#253368 from microsoft/dbaeumer/glad-guineafowl-lime
Fixes 251268: Errors from task with same owner as extension don't propagate to the EH
2 parents e73a19b + a565364 commit 499a93c

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

src/vs/monaco.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,7 @@ declare namespace monaco.editor {
14711471
modelVersionId?: number;
14721472
relatedInformation?: IRelatedInformation[];
14731473
tags?: MarkerTag[];
1474+
origin?: string | undefined;
14741475
}
14751476

14761477
/**
@@ -1491,6 +1492,7 @@ declare namespace monaco.editor {
14911492
modelVersionId?: number;
14921493
relatedInformation?: IRelatedInformation[];
14931494
tags?: MarkerTag[];
1495+
origin?: string | undefined;
14941496
}
14951497

14961498
/**

src/vs/platform/markers/common/markerService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class MarkerService implements IMarkerService {
232232
message, source,
233233
startLineNumber, startColumn, endLineNumber, endColumn,
234234
relatedInformation,
235-
tags,
235+
tags, origin
236236
} = data;
237237

238238
if (!message) {
@@ -258,6 +258,7 @@ export class MarkerService implements IMarkerService {
258258
endColumn,
259259
relatedInformation,
260260
tags,
261+
origin
261262
};
262263
}
263264

src/vs/platform/markers/common/markers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export interface IMarkerData {
118118
modelVersionId?: number;
119119
relatedInformation?: IRelatedInformation[];
120120
tags?: MarkerTag[];
121+
origin?: string | undefined;
121122
}
122123

123124
export interface IResourceMarker {
@@ -139,6 +140,7 @@ export interface IMarker {
139140
modelVersionId?: number;
140141
relatedInformation?: IRelatedInformation[];
141142
tags?: MarkerTag[];
143+
origin?: string | undefined;
142144
}
143145

144146
export interface MarkerStatistics {

src/vs/workbench/api/browser/mainThreadDiagnostics.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { IMarkerService, IMarkerData } from '../../../platform/markers/common/markers.js';
6+
import { IMarkerService, IMarkerData, type IMarker } from '../../../platform/markers/common/markers.js';
77
import { URI, UriComponents } from '../../../base/common/uri.js';
88
import { MainThreadDiagnosticsShape, MainContext, ExtHostDiagnosticsShape, ExtHostContext } from '../common/extHost.protocol.js';
99
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
1010
import { IDisposable } from '../../../base/common/lifecycle.js';
1111
import { IUriIdentityService } from '../../../platform/uriIdentity/common/uriIdentity.js';
12+
import { ResourceMap } from '../../../base/common/map.js';
1213

1314
@extHostNamedCustomer(MainContext.MainThreadDiagnostics)
1415
export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
@@ -18,6 +19,9 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
1819
private readonly _proxy: ExtHostDiagnosticsShape;
1920
private readonly _markerListener: IDisposable;
2021

22+
private static ExtHostCounter: number = 1;
23+
private readonly extHostId: string;
24+
2125
constructor(
2226
extHostContext: IExtHostContext,
2327
@IMarkerService private readonly _markerService: IMarkerService,
@@ -26,11 +30,27 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
2630
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostDiagnostics);
2731

2832
this._markerListener = this._markerService.onMarkerChanged(this._forwardMarkers, this);
33+
this.extHostId = `extHost${MainThreadDiagnostics.ExtHostCounter++}`;
2934
}
3035

3136
dispose(): void {
3237
this._markerListener.dispose();
33-
this._activeOwners.forEach(owner => this._markerService.changeAll(owner, []));
38+
for (const owner of this._activeOwners) {
39+
const markersData: ResourceMap<IMarker[]> = new ResourceMap<IMarker[]>();
40+
for (const marker of this._markerService.read({ owner })) {
41+
let data = markersData.get(marker.resource);
42+
if (data === undefined) {
43+
data = [];
44+
markersData.set(marker.resource, data);
45+
}
46+
if (marker.origin !== this.extHostId) {
47+
data.push(marker);
48+
}
49+
}
50+
for (const [resource, local] of markersData.entries()) {
51+
this._markerService.changeOne(owner, resource, local);
52+
}
53+
}
3454
this._activeOwners.clear();
3555
}
3656

@@ -41,9 +61,9 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
4161
if (allMarkerData.length === 0) {
4262
data.push([resource, []]);
4363
} else {
44-
const forgeinMarkerData = allMarkerData.filter(marker => !this._activeOwners.has(marker.owner));
45-
if (forgeinMarkerData.length > 0) {
46-
data.push([resource, forgeinMarkerData]);
64+
const foreignMarkerData = allMarkerData.filter(marker => marker?.origin !== this.extHostId);
65+
if (foreignMarkerData.length > 0) {
66+
data.push([resource, foreignMarkerData]);
4767
}
4868
}
4969
}
@@ -65,6 +85,9 @@ export class MainThreadDiagnostics implements MainThreadDiagnosticsShape {
6585
if (marker.code && typeof marker.code !== 'string') {
6686
marker.code.target = URI.revive(marker.code.target);
6787
}
88+
if (marker.origin === undefined) {
89+
marker.origin = this.extHostId;
90+
}
6891
}
6992
}
7093
this._markerService.changeOne(owner, this._uriIdentService.asCanonicalUri(URI.revive(uri)), markers);

0 commit comments

Comments
 (0)