File tree Expand file tree Collapse file tree 3 files changed +6
-37
lines changed
markdown-language-features Expand file tree Collapse file tree 3 files changed +6
-37
lines changed Original file line number Diff line number Diff line change 3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
- export class MultiDisposeError extends Error {
7
- constructor (
8
- public readonly errors : any [ ]
9
- ) {
10
- super ( `Encountered errors while disposing of store. Errors: [${ errors . join ( ', ' ) } ]` ) ;
11
- }
12
- }
13
-
14
6
export function disposeAll ( disposables : Iterable < IDisposable > ) {
15
7
const errors : any [ ] = [ ] ;
16
8
@@ -25,7 +17,7 @@ export function disposeAll(disposables: Iterable<IDisposable>) {
25
17
if ( errors . length === 1 ) {
26
18
throw errors [ 0 ] ;
27
19
} else if ( errors . length > 1 ) {
28
- throw new MultiDisposeError ( errors ) ;
20
+ throw new AggregateError ( errors , 'Encountered errors while disposing of store' ) ;
29
21
}
30
22
}
31
23
@@ -60,21 +52,3 @@ export abstract class Disposable {
60
52
}
61
53
}
62
54
63
- export class DisposableStore extends Disposable {
64
- private readonly items = new Set < IDisposable > ( ) ;
65
-
66
- public override dispose ( ) {
67
- super . dispose ( ) ;
68
- disposeAll ( this . items ) ;
69
- this . items . clear ( ) ;
70
- }
71
-
72
- public add < T extends IDisposable > ( item : T ) : T {
73
- if ( this . isDisposed ) {
74
- console . warn ( 'Adding to disposed store. Item will be leaked' ) ;
75
- }
76
-
77
- this . items . add ( item ) ;
78
- return item ;
79
- }
80
- }
Original file line number Diff line number Diff line change 5
5
6
6
import * as vscode from 'vscode' ;
7
7
8
- export class MultiDisposeError extends Error {
9
- constructor (
10
- public readonly errors : any [ ]
11
- ) {
12
- super ( `Encountered errors while disposing of store. Errors: [${ errors . join ( ', ' ) } ]` ) ;
13
- }
14
- }
15
-
16
8
export function disposeAll ( disposables : Iterable < vscode . Disposable > ) {
17
9
const errors : any [ ] = [ ] ;
18
10
@@ -27,7 +19,7 @@ export function disposeAll(disposables: Iterable<vscode.Disposable>) {
27
19
if ( errors . length === 1 ) {
28
20
throw errors [ 0 ] ;
29
21
} else if ( errors . length > 1 ) {
30
- throw new MultiDisposeError ( errors ) ;
22
+ throw new AggregateError ( errors , 'Encountered errors while disposing of store' ) ;
31
23
}
32
24
}
33
25
Original file line number Diff line number Diff line change 20
20
" ES2020.Promise" ,
21
21
" ES2020.String" ,
22
22
" ES2020.Symbol.WellKnown" ,
23
- " ES2020.Intl"
23
+ " ES2020.Intl" ,
24
+ " ES2021.Promise" ,
25
+ " ES2021.String" ,
26
+ " ES2021.WeakRef"
24
27
],
25
28
"module" : " commonjs" ,
26
29
"strict" : true ,
You can’t perform that action at this time.
0 commit comments