@@ -40,7 +40,7 @@ suite('ExtHostDiagnostics', () => {
40
40
41
41
test ( 'disposeCheck' , ( ) => {
42
42
43
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
43
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
44
44
45
45
collection . dispose ( ) ;
46
46
collection . dispose ( ) ; // that's OK
@@ -56,13 +56,13 @@ suite('ExtHostDiagnostics', () => {
56
56
57
57
58
58
test ( 'diagnostic collection, forEach, clear, has' , function ( ) {
59
- let collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
59
+ let collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
60
60
assert . strictEqual ( collection . name , 'test' ) ;
61
61
collection . dispose ( ) ;
62
62
assert . throws ( ( ) => collection . name ) ;
63
63
64
64
let c = 0 ;
65
- collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
65
+ collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
66
66
collection . forEach ( ( ) => c ++ ) ;
67
67
assert . strictEqual ( c , 0 ) ;
68
68
@@ -99,7 +99,7 @@ suite('ExtHostDiagnostics', () => {
99
99
} ) ;
100
100
101
101
test ( 'diagnostic collection, immutable read' , function ( ) {
102
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
102
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
103
103
collection . set ( URI . parse ( 'foo:bar' ) , [
104
104
new Diagnostic ( new Range ( 0 , 0 , 1 , 1 ) , 'message-1' ) ,
105
105
new Diagnostic ( new Range ( 0 , 0 , 1 , 1 ) , 'message-2' )
@@ -124,7 +124,7 @@ suite('ExtHostDiagnostics', () => {
124
124
125
125
126
126
test ( 'diagnostics collection, set with dupliclated tuples' , function ( ) {
127
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
127
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
128
128
const uri = URI . parse ( 'sc:hightower' ) ;
129
129
collection . set ( [
130
130
[ uri , [ new Diagnostic ( new Range ( 0 , 0 , 0 , 1 ) , 'message-1' ) ] ] ,
@@ -175,7 +175,7 @@ suite('ExtHostDiagnostics', () => {
175
175
test ( 'diagnostics collection, set tuple overrides, #11547' , function ( ) {
176
176
177
177
let lastEntries ! : [ UriComponents , IMarkerData [ ] ] [ ] ;
178
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
178
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
179
179
override $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) : void {
180
180
lastEntries = entries ;
181
181
return super . $changeMany ( owner , entries ) ;
@@ -209,7 +209,7 @@ suite('ExtHostDiagnostics', () => {
209
209
210
210
const emitter = new Emitter < any > ( ) ;
211
211
emitter . event ( _ => eventCount += 1 ) ;
212
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
212
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
213
213
override $changeMany ( ) {
214
214
changeCount += 1 ;
215
215
}
@@ -229,7 +229,7 @@ suite('ExtHostDiagnostics', () => {
229
229
230
230
test ( 'diagnostics collection, tuples and undefined (small array), #15585' , function ( ) {
231
231
232
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
232
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
233
233
const uri = URI . parse ( 'sc:hightower' ) ;
234
234
const uri2 = URI . parse ( 'sc:nomad' ) ;
235
235
const diag = new Diagnostic ( new Range ( 0 , 0 , 0 , 1 ) , 'ffff' ) ;
@@ -250,7 +250,7 @@ suite('ExtHostDiagnostics', () => {
250
250
251
251
test ( 'diagnostics collection, tuples and undefined (large array), #15585' , function ( ) {
252
252
253
- const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
253
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , new Emitter ( ) ) ;
254
254
const tuples : [ URI , Diagnostic [ ] ] [ ] = [ ] ;
255
255
256
256
for ( let i = 0 ; i < 500 ; i ++ ) {
@@ -271,10 +271,10 @@ suite('ExtHostDiagnostics', () => {
271
271
}
272
272
} ) ;
273
273
274
- test ( 'diagnostic capping' , function ( ) {
274
+ test ( 'diagnostic capping (max per file) ' , function ( ) {
275
275
276
276
let lastEntries ! : [ UriComponents , IMarkerData [ ] ] [ ] ;
277
- const collection = new DiagnosticCollection ( 'test' , 'test' , 250 , versionProvider , extUri , new class extends DiagnosticsShape {
277
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 100 , 250 , versionProvider , extUri , new class extends DiagnosticsShape {
278
278
override $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) : void {
279
279
lastEntries = entries ;
280
280
return super . $changeMany ( owner , entries ) ;
@@ -298,9 +298,31 @@ suite('ExtHostDiagnostics', () => {
298
298
assert . strictEqual ( lastEntries [ 0 ] [ 1 ] [ 250 ] . severity , MarkerSeverity . Info ) ;
299
299
} ) ;
300
300
301
+ test ( 'diagnostic capping (max files)' , function ( ) {
302
+
303
+ let lastEntries ! : [ UriComponents , IMarkerData [ ] ] [ ] ;
304
+ const collection = new DiagnosticCollection ( 'test' , 'test' , 2 , 1 , versionProvider , extUri , new class extends DiagnosticsShape {
305
+ override $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) : void {
306
+ lastEntries = entries ;
307
+ return super . $changeMany ( owner , entries ) ;
308
+ }
309
+ } , new Emitter ( ) ) ;
310
+
311
+ const diag = new Diagnostic ( new Range ( 0 , 0 , 1 , 1 ) , 'Hello' ) ;
312
+
313
+
314
+ collection . set ( [
315
+ [ URI . parse ( 'aa:bb1' ) , [ diag ] ] ,
316
+ [ URI . parse ( 'aa:bb2' ) , [ diag ] ] ,
317
+ [ URI . parse ( 'aa:bb3' ) , [ diag ] ] ,
318
+ [ URI . parse ( 'aa:bb4' ) , [ diag ] ] ,
319
+ ] ) ;
320
+ assert . strictEqual ( lastEntries . length , 3 ) ; // goes above the limit and then stops
321
+ } ) ;
322
+
301
323
test ( 'diagnostic eventing' , async function ( ) {
302
324
const emitter = new Emitter < readonly URI [ ] > ( ) ;
303
- const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , emitter ) ;
325
+ const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , emitter ) ;
304
326
305
327
const diag1 = new Diagnostic ( new Range ( 1 , 1 , 2 , 3 ) , 'diag1' ) ;
306
328
const diag2 = new Diagnostic ( new Range ( 1 , 1 , 2 , 3 ) , 'diag2' ) ;
@@ -338,7 +360,7 @@ suite('ExtHostDiagnostics', () => {
338
360
339
361
test ( 'vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582' , async function ( ) {
340
362
const emitter = new Emitter < readonly URI [ ] > ( ) ;
341
- const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , emitter ) ;
363
+ const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , 100 , versionProvider , extUri , new DiagnosticsShape ( ) , emitter ) ;
342
364
343
365
const diag1 = new Diagnostic ( new Range ( 1 , 1 , 2 , 3 ) , 'diag1' ) ;
344
366
@@ -361,7 +383,7 @@ suite('ExtHostDiagnostics', () => {
361
383
362
384
test ( 'diagnostics with related information' , function ( done ) {
363
385
364
- const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
386
+ const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
365
387
override $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) {
366
388
367
389
const [ [ , data ] ] = entries ;
@@ -424,7 +446,7 @@ suite('ExtHostDiagnostics', () => {
424
446
425
447
test ( 'Error updating diagnostics from extension #60394' , function ( ) {
426
448
let callCount = 0 ;
427
- const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
449
+ const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , 100 , versionProvider , extUri , new class extends DiagnosticsShape {
428
450
override $changeMany ( owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) {
429
451
callCount += 1 ;
430
452
}
@@ -451,7 +473,7 @@ suite('ExtHostDiagnostics', () => {
451
473
452
474
const all : [ UriComponents , IMarkerData [ ] ] [ ] = [ ] ;
453
475
454
- const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , uri => {
476
+ const collection = new DiagnosticCollection ( 'ddd' , 'test' , 100 , 100 , uri => {
455
477
return 7 ;
456
478
} , extUri , new class extends DiagnosticsShape {
457
479
override $changeMany ( _owner : string , entries : [ UriComponents , IMarkerData [ ] ] [ ] ) {
0 commit comments