File tree Expand file tree Collapse file tree
editor/contrib/documentSymbols Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,3 +18,19 @@ export class Counter {
1818 return this . _next ++ ;
1919 }
2020}
21+
22+ export class MovingAverage {
23+
24+ private _n = 1 ;
25+ private _val = 0 ;
26+
27+ update ( value : number ) : this {
28+ this . _val = this . _val + ( value - this . _val ) / this . _n ;
29+ this . _n += 1 ;
30+ return this ;
31+ }
32+
33+ get value ( ) : number {
34+ return this . _val ;
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { ITextModel } from 'vs/editor/common/model';
1414import { DocumentSymbol , DocumentSymbolProvider , DocumentSymbolProviderRegistry } from 'vs/editor/common/modes' ;
1515import { MarkerSeverity } from 'vs/platform/markers/common/markers' ;
1616import { Iterable } from 'vs/base/common/iterator' ;
17+ import { MovingAverage } from 'vs/base/common/numbers' ;
1718
1819export abstract class TreeElement {
1920
@@ -202,21 +203,7 @@ export class OutlineGroup extends TreeElement {
202203 }
203204}
204205
205- class MovingAverage {
206206
207- private _n = 1 ;
208- private _val = 0 ;
209-
210- update ( value : number ) : this {
211- this . _val = this . _val + ( value - this . _val ) / this . _n ;
212- this . _n += 1 ;
213- return this ;
214- }
215-
216- get value ( ) : number {
217- return this . _val ;
218- }
219- }
220207
221208export class OutlineModel extends TreeElement {
222209
You can’t perform that action at this time.
0 commit comments