@@ -14,6 +14,7 @@ import { mergeSort } from 'vs/base/common/arrays';
1414import { Event , Emitter } from 'vs/base/common/event' ;
1515import { ILogService } from 'vs/platform/log/common/log' ;
1616import { ResourceMap } from 'vs/base/common/map' ;
17+ import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions' ;
1718
1819export class DiagnosticCollection implements vscode . DiagnosticCollection {
1920
@@ -25,7 +26,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
2526 private readonly _owner : string ,
2627 private readonly _maxDiagnosticsPerFile : number ,
2728 private readonly _proxy : MainThreadDiagnosticsShape | undefined ,
28- private readonly _onDidChangeDiagnostics : Emitter < ( vscode . Uri | string ) [ ] >
29+ private readonly _onDidChangeDiagnostics : Emitter < vscode . Uri [ ] >
2930 ) { }
3031
3132 dispose ( ) : void {
@@ -215,7 +216,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
215216
216217 private readonly _proxy : MainThreadDiagnosticsShape ;
217218 private readonly _collections = new Map < string , DiagnosticCollection > ( ) ;
218- private readonly _onDidChangeDiagnostics = new Emitter < ( vscode . Uri | string ) [ ] > ( ) ;
219+ private readonly _onDidChangeDiagnostics = new Emitter < vscode . Uri [ ] > ( ) ;
219220
220221 static _debouncer ( last : ( vscode . Uri | string ) [ ] | undefined , current : ( vscode . Uri | string ) [ ] ) : ( vscode . Uri | string ) [ ] {
221222 if ( ! last ) {
@@ -251,8 +252,25 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
251252 this . _proxy = mainContext . getProxy ( MainContext . MainThreadDiagnostics ) ;
252253 }
253254
254- createDiagnosticCollection ( name ?: string ) : vscode . DiagnosticCollection {
255- let { _collections, _proxy, _onDidChangeDiagnostics } = this ;
255+ createDiagnosticCollection ( extensionId : ExtensionIdentifier , name ?: string ) : vscode . DiagnosticCollection {
256+
257+ const { _collections, _proxy, _onDidChangeDiagnostics, _logService } = this ;
258+
259+ const loggingProxy = new class implements MainThreadDiagnosticsShape {
260+ $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] | undefined ] [ ] ) : void {
261+ _proxy . $changeMany ( owner , entries ) ;
262+ _logService . trace ( '[DiagnosticCollection] change many (extension, owner, uris)' , extensionId . value , owner , entries . length === 0 ? 'CLEARING' : entries ) ;
263+ }
264+ $clear ( owner : string ) : void {
265+ _proxy . $clear ( owner ) ;
266+ _logService . trace ( '[DiagnosticCollection] remove all (extension, owner)' , extensionId . value , owner ) ;
267+ }
268+ dispose ( ) : void {
269+ _proxy . dispose ( ) ;
270+ }
271+ } ;
272+
273+
256274 let owner : string ;
257275 if ( ! name ) {
258276 name = '_generated_diagnostic_collection_name_#' + ExtHostDiagnostics . _idPool ++ ;
@@ -268,7 +286,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
268286
269287 const result = new class extends DiagnosticCollection {
270288 constructor ( ) {
271- super ( name ! , owner , ExtHostDiagnostics . _maxDiagnosticsPerFile , _proxy , _onDidChangeDiagnostics ) ;
289+ super ( name ! , owner , ExtHostDiagnostics . _maxDiagnosticsPerFile , loggingProxy , _onDidChangeDiagnostics ) ;
272290 _collections . set ( owner , this ) ;
273291 }
274292 dispose ( ) {
0 commit comments